Open
Bug 625239
Opened 15 years ago
Updated 4 years ago
SEC_ASN1EncodeInteger doesn't encode negative values in the minimum number of octets.
Categories
(NSS :: Libraries, defect, P2)
NSS
Libraries
Tracking
(Not tracked)
NEW
3.13
People
(Reporter: wtc, Unassigned)
Details
The bug was first reported in bug 572289 comment 5.
SEC_ASN1EncodeInteger doesn't encode negative values in the
minimum number of octets.
For example, -129 should be encoded as the following value
octets:
FF 7F
But SEC_ASN1EncodeInteger encodes -129 as the following value
octects on a 32-bit system (where unsigned long is 32 bits):
FF FF FF 7F
Similarly, -128 should be
80
but is encoded as
FF FF FF 80
The test program mozilla/security/nss/cmd/tests/encodeinttest.c
has these two test cases, commented out right now.
This bug may not be serious in practice because the decoders
in NSS (DER_GetInteger and SEC_ASN1DecodeInteger) can handle
extra leading 0xFF octets properly, and we probably don't
encode negative values often. But it is intellectually
interesting.
Updated•4 years ago
|
Severity: minor → S4
You need to log in
before you can comment on or make changes to this bug.
Description
•