mskcc / LimsRest

the restful service used by the IGO LIMS
2 stars 2 forks source link

SearchPoint calculation: Integer -> Long #196

Closed DavidStreid closed 3 years ago

DavidStreid commented 4 years ago

Change: Integer numDays = 0; -> Long numDays = 0L;

There's an Integer overflow when calculating the search point w/ days * 24 * 60 * 60 * 1000, e.g. long searchpoitn = System.currentTimeMillis() - (numDays * 24 * 60 * 60 * 1000). numDays needs to be changed to a Long

e.g.

System.out.println(Integer.MAX_VALUE + 1);   // -2147483648
System.out.println(Integer.MAX_VALUE);   // 2147483647

so {ANYTHING} minus {ANY_LARGE_INTEGER} is yielding some incorrect results

mskbot commented 4 years ago

Can one of the admins verify this patch?