[lld] [LLD] Use uint64_t timestamp to overcome potential overflow (PR #81665)
Jinsong Ji via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 14:27:21 PST 2024
================
@@ -167,7 +167,7 @@ uint64_t Symbol::getGotVA() const {
}
uint64_t Symbol::getGotOffset() const {
- return getGotIdx() * target->gotEntrySize;
+ return getGotIdx() * (uint64_t)target->gotEntrySize;
----------------
jsji wrote:
1468965 [Unintentional integer overflow](https://scan6.scan.coverity.com/doc/en/cov_checker_ref.html#static_checker_OVERFLOW_BEFORE_WIDEN)
The expression's value may not be what the programmer intended, because the expression is evaluated using a narrow (i.e. few bits) integer type.
In lld::elf::Symbol::getGotOffset(): An integer overflow occurs, with the result converted to a wider integer type ([CWE-190](http://cwe.mitre.org/data/definitions/190.html))
https://github.com/llvm/llvm-project/pull/81665
More information about the llvm-commits
mailing list