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

Jonathan Roelofs jonathan at codesourcery.com
Tue Mar 10 13:58:41 PDT 2015



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