This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 2/5] Let print_decimal_chars handle signed values
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Mon, 5 Jun 2017 18:22:12 +0100
- Subject: Re: [RFA 2/5] Let print_decimal_chars handle signed values
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0D5B91293
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0D5B91293
- References: <20170602193651.3173-1-tom@tromey.com> <20170602193651.3173-3-tom@tromey.com>
On 06/02/2017 08:36 PM, Tom Tromey wrote:
> + out_vec->reserve (len);
std::vector::reserve() != std::vector::resize() ...
> +
> + /* Compute -x == 1 + ~x. */
> + if (byte_order == BFD_ENDIAN_LITTLE)
> + {
> + unsigned carry = 1;
> + for (unsigned i = 0; i < len; ++i)
> + {
> + unsigned tem = (0xff & ~bytes[i]) + carry;
> + (*out_vec)[i] = tem & 0xff;
... so this is accessing beyond the std::vector's size.
Thanks,
Pedro Alves