ProgramState::assumeInBound does not handle large values well
| Bugzilla Link | 25284 |
| Resolution | WORKSFORME |
| Resolved on | Jun 26, 2020 10:16 |
| Version | trunk |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @Charusso,@ASDenysPetrov,@haoNoQ |
Extended Description
The ProgramState::assumeInBound() does not handle large values well.
I demonstrate by showing a FP, example code:
void f() {
int a[1LL<<40];
a[13] = 0;
}
Clang output:
1.c:5:11: warning: Access out-of-bound array element (buffer overflow)
a [13]=0;
~~~~~~^
This probably got fixed by https://reviews.llvm.org/D16063.
I have tried to reproduce the issue with clang-8, because my patch (https://reviews.llvm.org/D69599) from clang-10 potentially could fix this by storing the size symbol. However, it has been fixed before clang-8, so I think it is already fixed long ago. @NoQ, could we close this?
I couldn't reproduce it on the latest build. Looks like it could be fixed by https://reviews.llvm.org/D69599
I investigated this to see if I can solve this.
If the type parameter to ProgramState::assumeInBound() is empty it will just use Ctx.IntTy. Is this wanted? Would it be ok if I try to look at the UpperBound and NumElements and choose a Ctx.*Ty?
btw.. A little nit. I saw now that the error message points at the '='. It would be better imho if it pointed at the '['.
assigned to @tkremenek