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

Calculate correct mp4 header length. #9618

Merged
merged 1 commit into from Feb 12, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -325,8 +325,8 @@ impl Mp4Matcher {
return false;
}

let box_size = ((data[0] as u32) << 3 | (data[1] as u32) << 2 |
(data[2] as u32) << 1 | (data[3] as u32)) as usize;
let box_size = ((data[0] as u32) << 24 | (data[1] as u32) << 16 |
(data[2] as u32) << 8 | (data[3] as u32)) as usize;
if (data.len() < box_size) || (box_size % 4 != 0) {
return false;
}
@@ -37,6 +37,19 @@ fn test_sniff_mp4_matcher() {
}
}

#[test]
fn test_sniff_mp4_matcher_long() {
// Check that a multi-byte length is calculated correctly
let matcher = Mp4Matcher;

let mut data: [u8; 260] = [0; 260];
&data[.. 11].clone_from_slice(
&[0x00, 0x00, 0x01, 0x04, 0x66, 0x74, 0x79, 0x70, 0x6D, 0x70, 0x34]
);

assert!(matcher.matches(&data));
}

#[cfg(test)]
fn test_sniff_with_flags(filename_orig: &path::Path,
type_string: &str,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.