[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
================
@@ -1714,7 +1714,8 @@ void elf::postScanRelocations() {
if (!sym.isDefined()) {
replaceWithDefined(sym, *in.plt,
target->pltHeaderSize +
- target->pltEntrySize * sym.getPltIdx(),
+ (uint64_t)target->pltEntrySize *
+ sym.getPltIdx(),
----------------
jsji wrote:
1468946 [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::postScanRelocations()::[lambda(lld::elf::Symbol &) (instance 1)]::operator ()(lld::elf::Symbol &): 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