Avoid sign extension when comparing mtime with Instant#getEpochSecond

Ensure we use the same type when comparing seconds since the epoch.

This does not prevent that in 2038 timestamps in seconds since the epoch
stored in a 32 bit integer will overflow. Integer.MAX_VALUE translates
to 2038-01-19T03:14:07Z. After this date we'll have an issue since we
store seconds since the epoch in a 32 bit integer in some places.

Bug: 319142
Change-Id: If0c03003d40b480f044686e2f7a2f62c9f4e2fe1
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2019-08-21 00:29:45 +02:00
parent 6cb21049d7
commit c130e5e708
1 changed files with 1 additions and 1 deletions

View File

@ -378,7 +378,7 @@ public final boolean mightBeRacilyClean(Instant smudge) {
//
final int base = infoOffset + P_MTIME;
final int mtime = NB.decodeInt32(info, base);
if (smudge.getEpochSecond() == mtime) {
if ((int) smudge.getEpochSecond() == mtime) {
return smudge.getNano() <= NB.decodeInt32(info, base + 4);
}
return false;