Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1439)

Unified Diff: src/pkg/encoding/asn1/marshal.go

Issue 10140046: code review 10140046: asn1: Improved encoding/decoding for OID types (Closed)
Patch Set: diff -r 7eca82ec46af https://code.google.com/p/go Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/encoding/asn1/asn1_test.go ('k') | src/pkg/encoding/asn1/marshal_test.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/encoding/asn1/marshal.go
===================================================================
--- a/src/pkg/encoding/asn1/marshal.go
+++ b/src/pkg/encoding/asn1/marshal.go
@@ -240,11 +240,11 @@
}
func marshalObjectIdentifier(out *forkableWriter, oid []int) (err error) {
- if len(oid) < 2 || oid[0] > 6 || oid[1] >= 40 {
+ if len(oid) < 2 || oid[0] > 2 || (oid[0] < 2 && oid[1] >= 40) {
return StructuralError{"invalid object identifier"}
}
- err = out.WriteByte(byte(oid[0]*40 + oid[1]))
+ err = marshalBase128Int(out, int64(oid[0]*40+oid[1]))
if err != nil {
return
}
« no previous file with comments | « src/pkg/encoding/asn1/asn1_test.go ('k') | src/pkg/encoding/asn1/marshal_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b