diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-09-28 21:16:58 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-09-28 21:16:58 +0000 |
commit | 09cc08654a98e74868b4e00b561878c5deefa045 (patch) | |
tree | 1fdc7cdc29437296dc41a6fc2b502e3d394e938c /llvm/lib/Object/MachOObjectFile.cpp | |
parent | cb85d7f840b1d2398fcbd1998c4f10755dfeb0bb (diff) | |
download | bcm5719-llvm-09cc08654a98e74868b4e00b561878c5deefa045.tar.gz bcm5719-llvm-09cc08654a98e74868b4e00b561878c5deefa045.zip |
Improve 'last_write_time(...)' accuracy and detect overflow errors.
The ::stat struct on Linux, FreeBSD, and OS X provides the access and
modification times as an instance of 'timespec', which has a nanosecond
resolution. The 'st_mtime' and 'st_atime' members simply reference the 'tv_sec'
value of the timespec struct. This patch changes 'last_write_time(...)' so that
it extracts both the seconds and nanoseconds values of the last modification
time, providing a more accurate implementation of 'last_write_time(...)'.
Additionally this patch fixes a possible signed integer overflow bug. The
'file_time_type' type cannot represent all possible values returned by
the filesystem. Attempting to construct a 'file_time_type' from one of these
values is undefined behavior. This patch avoids that UB by detecting possible
overflows before the conversion.
llvm-svn: 282634
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
0 files changed, 0 insertions, 0 deletions