This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 2/5] Let print_decimal_chars handle signed values


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]