Skip to content
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

Allow decoding empty sequences #336

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

main--
Copy link

@main-- main-- commented Mar 26, 2025

Proposed fix for #335.

Copy link

codecov bot commented Mar 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.77%. Comparing base (ab50614) to head (3562e37).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #336   +/-   ##
=======================================
  Coverage   97.76%   97.77%           
=======================================
  Files          20       20           
  Lines        4343     4351    +8     
=======================================
+ Hits         4246     4254    +8     
  Misses         97       97           

☔ 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.

@ctz
Copy link
Member

ctz commented Mar 27, 2025

I think we should try and avoid relaxing CRL extension parsing at the same time. Therefore I suggest leaving nested_of_mut alone, and fixing this one layer up in the immediate caller, Cert::from_der.

@main-- main-- force-pushed the empty-extensions branch from 9458d55 to 3562e37 Compare March 28, 2025 19:44
use pki_types::CertificateDer;

#[test]
fn cert_without_extensions_test() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in an existing test file IMO.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just trying to be consistent with cert_without_extensions.rs. I'm happy to move it, just let me know where.

&Extension::from_der(extension)?,
)
|outer| {
while !outer.at_end() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think just inlining this is a good solution either given the duplication and lack of clarity. Instead, maybe we can pass an extra bool argument to remember_cert_extension()?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember_cert_extension() is not even called though? The inner nested fails when trying to parse a sequence from an empty slice.

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.

3 participants