[libcxxabi] r231839 - [libcxx] Fix PR21580 - Undefined behavior in readEncodedPointer()

Eric Fiselier eric at efcs.ca
Tue Mar 10 14:35:20 PDT 2015


Woops, Thanks...

Not sure why I was doing that. Fixed in r231852.


On Tue, Mar 10, 2015 at 4:58 PM, Jonathan Roelofs
<jonathan at codesourcery.com> wrote:
>
>
> On 3/10/15 2:43 PM, Eric Fiselier wrote:
>>
>> Author: ericwf
>> +template <class AsType>
>> +uintptr_t readPointerHelper(const uint8_t*& p) {
>> +    AsType value;
>> +    memcpy(&value, const_cast<uint8_t*>(p), sizeof(AsType));
>
>
> memcpy's second arg is a const void*. I think what you want here is
> static_cast<const void*>(p) instead of the const_cast.
>
>
> Cheers,
>
> Jon
>
>
>> +    p += sizeof(AsType);
>> +    return static_cast<uintptr_t>(value);
>> +}
>
>
> --
> Jon Roelofs
> jonathan at codesourcery.com
> CodeSourcery / Mentor Embedded



More information about the cfe-commits mailing list