[PATCH] D33149: Avoid a UB pointer overflow in the ArrayRef unit test

Vedant Kumar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 09:47:10 PDT 2017


vsk added a comment.

In https://reviews.llvm.org/D33149#755166, @ab wrote:

> Huh, interesting..  Not a big deal, but can you avoid the #ifdef?  Where was the overflow?


The overflow occurred in drop_front etc. The start of the array moved from 0x10000 to 2^64 - 2.

I think these tests need to add UINT_MAX or greater to a pointer to check that size_t-sized lengths work. For 32-bit machines, I don't think there's a way to add such a large offset to a pointer and not overflow.


https://reviews.llvm.org/D33149





More information about the llvm-commits mailing list