kellerkindt / asn1rs

Generates Rust Code and optionally compatible Protobuf schema files from ASN.1 definitions.
http://asn1.rs
Apache License 2.0
55 stars 20 forks source link

Error parsing INTEGER with 64-bit value range #79

Open awm129 opened 1 year ago

awm129 commented 1 year ago

I'm trying to use asn1rs 0.2.2 with the following ASN.1 subtype definition:

Uint64 ::= INTEGER (0..18446744073709551615)

when I run asn1rs from the shell I get:

[tmp]$ asn1rs --version
asn1rs 0.2.2
[tmp]$ asn1rs . ../int_types.asn1 
Failed to convert: ResolveError(FailedToResolveReference("18446744073709551615"))

The above definition compiles successfully with asn1c v0.9.29.

While I can leave this unconstrained as a work around, the ASN.1 spec allows for value ranges larger than those that can be represented in 64 bits. The maximum upper bound I'm able to use successfully with asn1rs appears to be equivalent to i64::MAX.