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

6.2.2. Signature for WebM will always return false. #185

Closed
jyavenard opened this issue Mar 18, 2024 · 0 comments · Fixed by #187
Closed

6.2.2. Signature for WebM will always return false. #185

jyavenard opened this issue Mar 18, 2024 · 0 comments · Fixed by #187

Comments

@jyavenard
Copy link
Member

What is the issue with the MIME Sniffing Standard?

In its current state, the Signature for WebM algorithm will always return false.
https://mimesniff.spec.whatwg.org/#signature-for-webm

current step 6 reads:

6. While iter is less than length and iter is less than 38, continuously loop through these steps:
  1. If the two bytes from sequence[iter] to sequence[iter + 1] are equal to 0x42 0x82,
    1. Increment iter by 2.
    2. If iter is greater or equal than length, abort these steps.
    3. Let number size be the result of [parsing a vint](https://mimesniff.spec.whatwg.org/#parse-a-vint) starting at sequence[iter].
    4. Increment iter by number size.
    5. If iter is less than length - 4, abort these steps.
    6. Let matched be the result of [matching a padded sequence](https://mimesniff.spec.whatwg.org/#matching-a-padded-sequence) 0x77 0x65 0x62 0x6D ("webm") on sequence at offset iter.
    7. If matched is true, abort these steps and return true.
  2. Increment iter by 1.
7. Return false.

at step 6.1.5 If iter is less than length - 4, abort these steps. this condition will normally always be true: we have not iterated to the end of the file yet, so iter will always be less than length - 4

it should read:
If iter is greater than length - 4, abort these steps.

jyavenard added a commit to jyavenard/mimesniff that referenced this issue Mar 19, 2024
Correct inverted test logic to determine if we've reached the end of the EBML element.

(fixes whatwg#185)
annevk pushed a commit that referenced this issue Mar 25, 2024
Correct inverted test logic to determine if we've reached the end of the EBML element.

Fixes #185.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant