-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OER encoder produces output that it can't decode #258
Comments
Cc @Nicceboy |
Seems like this bug is triggered because the While this should not happen in most cases on later standards, maybe something needs to be done. Should I just throw error or try to explore possible decode variations and choose the first suitable? On simple types it would work, but no guarantees for complex ones as far as I know. |
Are you sure there's nothing? That is a case that is called out in other standards. You might want to check both the OER and X680 standards. |
This was all I could find related to this: From OER standard:
From X680
|
Here is an example of ambiguous case: OuterChoice ::= CHOICE {
a INTEGER,
b InnerChoice
}
InnerChoice ::= CHOICE {
c INTEGER,
d BOOLEAN
} In both cases the outermost encoded value would be the same, whether Decoder would need to identify the correct type/value selection by peeking next bytes or otherwise trying to understand the context, but this feels a bit too complex to add and does not guarantee correctness. BER handles this by using nested TLV pattern, and PER handles this by using indexes. Rather, maybe it would be better to encourage here that ASN.1 type specifications should be designed to be less ambiguous with OER (e.g. use tags), instead of trying to implement something for now. We could implement encoder (potentially), but not decoder. I could implement complete decoder, if someone shows me the section(s) in standard(s) which proves that this is not ambiguous. |
I've been doing a spot of testing of the new OER implementation and found some inputs that produce encoder output that the OER decoder refuses to decode. @XAMPPRocky asked that I report them here to be fixed.
Example
Input
Error
Fuzz target
Fuzzer output
The text was updated successfully, but these errors were encountered: