Description
OIDFromInts computes the first DER subidentifier as oid[0]*40 + oid[1] in uint64. For OIDs under arc 2, a very large second component can overflow and wrap to a different DER encoding. That can make an unusual local OID input produce an OID different from the one requested by the caller.
The impact requires local code to construct OIDs with very large integer components.
Specification
ITU-T X.690 Section 8.19 defines DER encoding for OBJECT IDENTIFIER values, including the first subidentifier derived from the first two arcs. The encoding should represent the requested OID components, not a wrapped arithmetic result.
Code references
go/src/crypto/x509/oid.go:54 defines OIDFromInts.
go/src/crypto/x509/oid.go:56 validates the first two arcs.
go/src/crypto/x509/oid.go:60 computes oid[0]*40 + oid[1] without an overflow check.
go/src/crypto/x509/oid.go:66 encodes that potentially wrapped value.
Test case
This should be a Go unit test for OIDFromInts([]uint64{2, math.MaxUint64}) or similar large second components. The expected behavior should be a clear error.
It could be paired with an OID parser/serializer property test.
Description
OIDFromIntscomputes the first DER subidentifier asoid[0]*40 + oid[1]inuint64. For OIDs under arc2, a very large second component can overflow and wrap to a different DER encoding. That can make an unusual local OID input produce an OID different from the one requested by the caller.The impact requires local code to construct OIDs with very large integer components.
Specification
ITU-T X.690 Section 8.19 defines DER encoding for OBJECT IDENTIFIER values, including the first subidentifier derived from the first two arcs. The encoding should represent the requested OID components, not a wrapped arithmetic result.
Code references
go/src/crypto/x509/oid.go:54definesOIDFromInts.go/src/crypto/x509/oid.go:56validates the first two arcs.go/src/crypto/x509/oid.go:60computesoid[0]*40 + oid[1]without an overflow check.go/src/crypto/x509/oid.go:66encodes that potentially wrapped value.Test case
This should be a Go unit test for
OIDFromInts([]uint64{2, math.MaxUint64})or similar large second components. The expected behavior should be a clear error.It could be paired with an OID parser/serializer property test.