Skip to content

der: Reject non-canonical encoding of bit strings.#484

Open
briansmith wants to merge 4 commits intorustls:mainfrom
briansmith:b/bit-string-clarification
Open

der: Reject non-canonical encoding of bit strings.#484
briansmith wants to merge 4 commits intorustls:mainfrom
briansmith:b/bit-string-clarification

Conversation

@briansmith
Copy link
Copy Markdown
Contributor

See each individual commit message. Note that originally I just wanted to clarify the control flow, but in the process I noticed this improvement needs to be made. I think this new control flow is clearer, so I didn't try to fix the issue with the old control flow.

Also test the cases where only a single padding bit is nonzero, in
addition to the existing test case where all the padding bits are
nonzero.
…bytes.

I had trouble reading the previous implementation of the function, so I
tried to clarify the control flow. Along the way, I noticed that there is
a missing case. I think this new control flow is much clearer.

Also fix the misleading comment "If there are padding bits then the last
bit of the last raw byte must be 0": Actually all the padding bits must
be zero, which was what was correctly being checked.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.98%. Comparing base (55a52f3) to head (a46879f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #484      +/-   ##
==========================================
+ Coverage   96.97%   96.98%   +0.01%     
==========================================
  Files          20       20              
  Lines        3936     3953      +17     
==========================================
+ Hits         3817     3834      +17     
  Misses        119      119              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@briansmith briansmith force-pushed the b/bit-string-clarification branch from d3c23ec to a46879f Compare April 24, 2026 19:32
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.

1 participant