Date: Wed, 13 Mar 2019 13:17:05 +0100 From: Dimitry Andric <dim@FreeBSD.org> To: Willem Jan Withagen <wjw@digiware.nl> Cc: FreeBSD Toolchain <freebsd-toolchain@freebsd.org> Subject: Re: Is this a programming error, or a compiler error.. Message-ID: <98EFC560-16A0-4F62-892A-64B15B21AF21@FreeBSD.org> In-Reply-To: <bc4f8f4f-55c9-63ed-1ce8-b53d95a0696a@digiware.nl> References: <bc4f8f4f-55c9-63ed-1ce8-b53d95a0696a@digiware.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_0A0E58B5-10EF-4886-BA3E-B70D8DCFD5EF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 13 Mar 2019, at 12:57, Willem Jan Withagen <wjw@digiware.nl> wrote: >=20 > I'm getting a crash in a Ceph test program in the following pice of = code: >=20 > struct entity_addrvec_t { > vector<entity_addr_t> v; > ..... > entity_addr_t legacy_addr() const { > for (auto& a : v) { > if (a.type =3D=3D entity_addr_t::TYPE_LEGACY) { > return a; > } > } > return entity_addr_t(); > } > ...... >=20 > Where the loop is taken, even if v.size() =3D=3D 0 > So v content is pointing to random memory and itterating over the next = pointer results in a crash. This can happen when the vector is invalidated, due to either it, or its parent object having been moved from. Maybe run this under valgrind or AddressSanitizer, that should give some more clues. -Dimitry --Apple-Mail=_0A0E58B5-10EF-4886-BA3E-B70D8DCFD5EF Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXIj0wQAKCRCwXqMKLiCW ozqNAKCdU6u26/t8zJLS6lt9XN6rhNMuAQCcD0aDm8mbqvYO0GvUu7gQl6EKZak= =1mrP -----END PGP SIGNATURE----- --Apple-Mail=_0A0E58B5-10EF-4886-BA3E-B70D8DCFD5EF--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?98EFC560-16A0-4F62-892A-64B15B21AF21>