================
@@ -294,12 +294,14 @@ bool Context::evaluateStrlen(State &Parent, const Expr
*E, uint64_t &Result) {
if (!FieldDesc->isPrimitiveArray())
return false;
- if (Ptr.isDummy() || Ptr.isUnknownSizeArray())
+ if (Ptr.isDummy() || Ptr.isUnknownSizeArray() || Ptr.isPastEnd())
return false;
unsigned N = Ptr.getNumElems();
if (Ptr.elemSize() == 1) {
- Result = strnlen(reinterpret_cast<const char *>(Ptr.getRawAddress()), N);
+ unsigned Size = N - Ptr.getIndex();
+ Result =
+ strnlen(reinterpret_cast<const char *>(Ptr.getRawAddress()), Size);
return Result != N;
----------------
ojhunt wrote:
oh, the answer: I am a muppet and have two copies locally with nearly identical
names. So that means that the tests are clearly not actually triggering the
erroneous `Result != N` in this branch
https://github.com/llvm/llvm-project/pull/173212
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits