The intent of the test is to check that array lengths greater than
UINT_MAX work properly. Change the test to stress that scenario, without
triggering pointer overflow UB.
Caught by a WIP pointer overflow checker in clang.
Differential D33149
Avoid a UB pointer overflow in the ArrayRef unit test vsk on May 12 2017, 1:08 PM. Authored by
Details The intent of the test is to check that array lengths greater than Caught by a WIP pointer overflow checker in clang.
Diff Detail
Event TimelineComment Actions Huh, interesting.. Not a big deal, but can you avoid the #ifdef? Where was the overflow? Comment Actions 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. Comment Actions Ahmed and I chatted about this. We discussed an alternative to this patch, which is to test with a length of max<ptroff_t>. This version of the test wouldn't require any ifdefs, and would still add some coverage for r271546. |