mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-04-24 15:56:07 +00:00
Check for the possibility of an overflow when parsing OTP period
The conversion of the OTP period value to milliseconds may overflow for large values, causing the result to wrap around to Integer.MIN_VALUE. This subsequently caused a crash when calling ObjectAnimator.setDuration.
This commit is contained in:
parent
9cb9d47857
commit
58d13ba9e3
1 changed files with 6 additions and 1 deletions
|
@ -55,7 +55,12 @@ public class TotpInfo extends OtpInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isPeriodValid(int period) {
|
public static boolean isPeriodValid(int period) {
|
||||||
return period > 0;
|
if (period <= 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check for the possibility of an overflow when converting to milliseconds
|
||||||
|
return period <= Integer.MAX_VALUE / 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPeriod(int period) throws OtpInfoException {
|
public void setPeriod(int period) throws OtpInfoException {
|
||||||
|
|
Loading…
Add table
Reference in a new issue