Open bjangelo opened 2 months ago
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
Perhaps the parseField
function is just missing a case statement for TagBoolean
when dealing with any
type?
diff --git a/src/encoding/asn1/asn1.go b/src/encoding/asn1/asn1.go
index 781ab87691..72d3f84f1c 100644
--- a/src/encoding/asn1/asn1.go
+++ b/src/encoding/asn1/asn1.go
@@ -726,6 +726,8 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
result = innerBytes
case TagBMPString:
result, err = parseBMPString(innerBytes)
+ case TagBoolean:
+ result, err = parseBool(innerBytes)
default:
// If we don't know how to handle the type, we just leave Value as nil.
}
cc @golang/security per https://dev.golang.org/owners
Change https://go.dev/cl/595796 mentions this issue: encoding/asn1: unmarshal bool values correctly dealing with the ANY type
Go version
go version go1.22.3 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Attempted to unmarshal boolean asn1 value into any type.
https://go.dev/play/p/QEFu_kJD6b4
What did you see happen?
Unmarshal consumed the boolean TLV but did not populate the any type variable.
What did you expect to see?
Unmarshal populate the any type variable.