Skip to content

Conversation

@tarcieri
Copy link
Member

BER encodings were being miscomputed for certain large arcs.

The previous method was a bit wacky (in addition to being buggy) and attempted to encode each arc backwards within the BER output buffer.

This switches to a new method which splits the upper 7 bits from an arc and encodes that as a byte, continuing until all bytes of the arc have been encoded, which is much more straightforward.

The problematic cases which were reported have now been corrected.

Fixes #1520

cc @zhengyao-lin

BER encodings were being miscomputed for certain large arcs.

The previous method was a bit wacky (in addition to being buggy) and
attempted to encode each arc backwards within the BER output buffer.

This switches to a new method which splits the upper 7 bits from an arc
and encodes that as a byte, continuing until all bytes of the arc have
been encoded, which is much more straightforward.

The problematic cases which were reported have now been corrected.

Fixes #1520
@tarcieri
Copy link
Member Author

Note: with const_mut_refs now stable (rust-lang/rust#57349) and shipping in Rust 1.83, we will be able to completely rewrite all of the parsing/encoding logic in a much more straightforward way before the next release.

This PR isn't great, but at least stops the bleeding.

@tarcieri tarcieri merged commit 7c4638b into master Sep 18, 2024
113 checks passed
@tarcieri tarcieri deleted the const-oid/fix-oid-encoder branch September 18, 2024 18:31
@tarcieri tarcieri mentioned this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect Object Identifier DER Encoding

2 participants