Fix overflow that prevents matching

This commit is contained in:
Christian Grigis 2020-10-08 11:38:57 +02:00 committed by Marvin W
parent 5b06366cd5
commit 4e3c03cfaa
No known key found for this signature in database
GPG Key ID: 072E9235DB996F2A

View File

@ -346,7 +346,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit
val keys = listSingleDiagnosisKeysPendingSearch(tid, database)
val oldestRpi = oldestRpi
for (key in keys) {
if ((key.rollingStartIntervalNumber + key.rollingPeriod) * ROLLING_WINDOW_LENGTH_MS + ALLOWED_KEY_OFFSET_MS < oldestRpi) {
if ((key.rollingStartIntervalNumber + key.rollingPeriod).toLong() * ROLLING_WINDOW_LENGTH_MS + ALLOWED_KEY_OFFSET_MS < oldestRpi) {
// Early ignore because key is older than since we started scanning.
applySingleDiagnosisKeySearchResult(key, false, database)
} else {
@ -385,7 +385,7 @@ class ExposureDatabase private constructor(private val context: Context) : SQLit
riskLogged = key.transmissionRiskLevel
Log.d(TAG, "First key with risk ${key.transmissionRiskLevel}: ${ByteString.of(*key.keyData).hex()} starts ${key.rollingStartIntervalNumber}")
}
if ((key.rollingStartIntervalNumber + key.rollingPeriod) * ROLLING_WINDOW_LENGTH_MS + ALLOWED_KEY_OFFSET_MS < oldestRpi) {
if ((key.rollingStartIntervalNumber + key.rollingPeriod).toLong() * ROLLING_WINDOW_LENGTH_MS + ALLOWED_KEY_OFFSET_MS < oldestRpi) {
// Early ignore because key is older than since we started scanning.
ignored++;
} else {