[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:21:18 PST 2024


jsji wrote:

> information about what those are, and where.

If you have access to LLVM Coverity Scan, you will find it here.

https://scan6.scan.coverity.com/#/project-view/57984/10600?selectedIssue=1495973


```
1809  } else {
1810    config->repro = false;
      	
CID 1495973: (#1 of 1): Use of 32-bit time_t (Y2K38_SAFETY)
1. store_truncates_time_t: A time_t value is stored in an integer with too few bits to accommodate it. The expression time(NULL) is cast to uint32_t.
1811    config->timestamp = time(nullptr);
1812  }
1813
```

```
1495973 [Use of 32-bit time_t](https://scan6.scan.coverity.com/doc/en/cov_checker_ref.html#static_checker_Y2K38_SAFETY)
The time value stored in this integer will represent a different, but possibly valid, time.

In lld::​coff::​LinkerDriver::​linkerMain(llvm::​ArrayRef<char const *>): A 64-bit time_t value is stored in a smaller width integer. ([CWE-197](http://cwe.mitre.org/data/definitions/197.html))
```

https://github.com/llvm/llvm-project/pull/81665


More information about the llvm-commits mailing list