You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the new identity/src/commonMain/kotlin/com/android/identity/asn1/ASN1BitString.kt implementation, it looks like there's a bug in the BooleanArray constructor when it's calculating numUnusedBits:
If booleanValues.size % 8 == 0, then numUnusedBits is set to 8, while the standard expects it to be from 0-7. In the parsing code, if numUnusedBits is set to 8, we may end up skipping a byte.
That calculation looks like it should be: ((8 - (booleanValues.size % 8)) & 0x07)
Or, equivalently: ((8 - (booleanValues.size % 8)) % 8)
The text was updated successfully, but these errors were encountered:
In the new identity/src/commonMain/kotlin/com/android/identity/asn1/ASN1BitString.kt implementation, it looks like there's a bug in the BooleanArray constructor when it's calculating numUnusedBits:
If booleanValues.size % 8 == 0, then numUnusedBits is set to 8, while the standard expects it to be from 0-7. In the parsing code, if numUnusedBits is set to 8, we may end up skipping a byte.
That calculation looks like it should be: ((8 - (booleanValues.size % 8)) & 0x07)
Or, equivalently: ((8 - (booleanValues.size % 8)) % 8)
The text was updated successfully, but these errors were encountered: