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

Make page CRC verification toggleable by end-users #44

Merged
merged 6 commits into from
Oct 13, 2024

Conversation

AlexTMjugador
Copy link
Contributor

@AlexTMjugador AlexTMjugador commented Oct 12, 2024

These changes make the Ogg page CRC verification check toggleable at runtime by end-users via a new PageParsingOptions struct that may be passed at reader/parser construction time. I have paid special attention to making the new feature both backwards and forwards compatible, which led me to taking the following design choices:

  • No signature of any existing public method was modified. People looking into changing parsing behavior via the new PageParsingOptions struct must use the new *_with_parse_opts methods.
  • Marking PageParsingOptions as #[non_exhaustive], so that we may add new public fields to it in the future without a semver-breaking change. Users must always default-initialize this struct. It only derives Clone too, in case we ever need to make it hold non-Copy types.
  • Shared ownership of the PageParsingOptions between different reader structs is achieved through Arcs, which ensures that no struct stops being Send or Sync with a negligble performance impact.

The fuzzing cfg flag is still honored after these changes by using it to set a default value for the new verify_checksum page parsing option accordingly.

The need for these changes has been brought forward in OptiVorbis/OptiVorbis#101.

These changes make the Ogg page CRC verification check toggleable at
runtime by end-users via a new `PageParsingOptions` struct that may be
passed at reader/parser construction time. I have paid special attention
to making the new feature both backwards and forwards compatible, which
led me to taking the following design choices:

- No signature of any existing public method was modified. People
  looking into changing parsing behavior via the new
  `PageParsingOptions` struct must use the new `*_with_parse_opts`
  methods.
- Marking `PageParsingOptions` as `#[non_exhaustive]`, so that we may
  add new public fields to it in the future without a semver-breaking
  change. Users must always default-initialize this struct. It only
  derives `Clone` too, in case we ever need to make it hold non-`Copy`
  types.
- Shared ownership of the `PageParsingOptions` between different reader
  structs is achieved through `Arc`s, which ensures that no struct stops
  being `Send` or `Sync` with a negligble performance impact.

The `fuzzing` cfg flag is still honored after these changes by using it
to set a default value for the new `verify_hash` page parsing option
accordingly.
We required it anyway due to recent changes.
@AlexTMjugador
Copy link
Contributor Author

This PR also bumps the MSRV to 1.61 to fix CI checks, as it is required for the current code to work anyway (the screenshot below is from cargo msrv):

image

AlexTMjugador added a commit to OptiVorbis/OptiVorbis that referenced this pull request Oct 12, 2024
Resolves #101. An OptiVorbis release with this feature is blocked until
RustAudio/ogg#44 gets merged and an `ogg`
release with it is published, as patched dependencies can't be used on
`crates.io`.
AlexTMjugador added a commit to OptiVorbis/OptiVorbis that referenced this pull request Oct 12, 2024
Resolves #101. An OptiVorbis release with this feature is blocked until
RustAudio/ogg#44 gets merged and an `ogg`
release with it is published, as patched dependencies can't be used on
`crates.io`.
AlexTMjugador added a commit to OptiVorbis/OptiVorbis that referenced this pull request Oct 12, 2024
Resolves #101. An OptiVorbis release with this feature is blocked until
RustAudio/ogg#44 gets merged and an `ogg`
release with it is published, as patched dependencies can't be used on
`crates.io`.
@est31 est31 merged commit 90f45e2 into RustAudio:master Oct 13, 2024
9 checks passed
@AlexTMjugador AlexTMjugador deleted the feat/parse-opts branch October 13, 2024 22:31
@AlexTMjugador
Copy link
Contributor Author

Thanks for the quick review and merge! 🚀

I was wondering if there are any plans to publish a release with these changes soon? I'd love to try them out on a new OptiVorbis release too, but no worries if we have to wait a little longer 😉

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.

2 participants