Bug 1814736 - Update mp4parse to fix a crash on files with invalid box sizes. r=kinetik

Differential Revision: https://phabricator.services.mozilla.com/D169163
This commit is contained in:
zaggy1024 2023-02-08 01:36:17 +00:00
Родитель 38fce4f9a3
Коммит 7217f6c812
7 изменённых файлов: 19 добавлений и 6 удалений

Просмотреть файл

@ -102,7 +102,7 @@ replace-with = "vendored-sources"
[source."https://github.com/mozilla/mp4parse-rust"]
git = "https://github.com/mozilla/mp4parse-rust"
rev = "40763b69d75e14abaa25c6438271eb552dc2b9e9"
rev = "2b572e83608a3d0867b935e076f45d9fe248069d"
replace-with = "vendored-sources"
[source."https://github.com/mozilla/neqo"]

4
Cargo.lock сгенерированный
Просмотреть файл

@ -3596,7 +3596,7 @@ dependencies = [
[[package]]
name = "mp4parse"
version = "0.16.0"
source = "git+https://github.com/mozilla/mp4parse-rust?rev=40763b69d75e14abaa25c6438271eb552dc2b9e9#40763b69d75e14abaa25c6438271eb552dc2b9e9"
source = "git+https://github.com/mozilla/mp4parse-rust?rev=2b572e83608a3d0867b935e076f45d9fe248069d#2b572e83608a3d0867b935e076f45d9fe248069d"
dependencies = [
"bitreader",
"byteorder",
@ -3613,7 +3613,7 @@ version = "0.1.0"
[[package]]
name = "mp4parse_capi"
version = "0.16.0"
source = "git+https://github.com/mozilla/mp4parse-rust?rev=40763b69d75e14abaa25c6438271eb552dc2b9e9#40763b69d75e14abaa25c6438271eb552dc2b9e9"
source = "git+https://github.com/mozilla/mp4parse-rust?rev=2b572e83608a3d0867b935e076f45d9fe248069d#2b572e83608a3d0867b935e076f45d9fe248069d"
dependencies = [
"byteorder",
"fallible_collections",

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

2
third_party/rust/mp4parse/src/lib.rs поставляемый
Просмотреть файл

@ -2422,7 +2422,7 @@ fn skip_box_content<T: Read>(src: &mut BMFFBox<T>) -> Result<()> {
header
.size
.checked_sub(header.offset)
.expect("header offset > size")
.ok_or(Error::Unsupported("Skipping past unknown sized box"))?
};
assert_eq!(to_skip, src.bytes_left());
skip(src, to_skip)

13
third_party/rust/mp4parse/tests/public.rs поставляемый
Просмотреть файл

@ -66,6 +66,8 @@ static IMAGE_AVIF_IROT_MISSING_ESSENTIAL: &str = "tests/irot-missing-essential.a
static IMAGE_AVIF_LSEL_MISSING_ESSENTIAL: &str = "tests/corrupt/lsel-missing-essential.avif";
static IMAGE_AVIF_CLAP_MISSING_ESSENTIAL: &str = "tests/clap-missing-essential.avif";
static IMAGE_AVIF_UNKNOWN_MDAT_SIZE: &str = "tests/unknown_mdat.avif";
static IMAGE_AVIF_UNKNOWN_MDAT_SIZE_IN_OVERSIZED_META: &str =
"tests/unknown_mdat_in_oversized_meta.avif";
static AVIF_TEST_DIRS: &[&str] = &["tests", "av1-avif/testFiles", "link-u-avif-sample-images"];
// These files are
@ -124,6 +126,7 @@ static AVIF_UNSUPPORTED_IMAGES: &[&str] = &[
/// and https://github.com/AOMediaCodec/av1-avif/issues/178
// TODO: make this into a map of expected errors?
static AV1_AVIF_CORRUPT_IMAGES: &[&str] = &[
IMAGE_AVIF_UNKNOWN_MDAT_SIZE_IN_OVERSIZED_META,
"av1-avif/testFiles/Link-U/kimono.crop.avif",
"av1-avif/testFiles/Link-U/kimono.mirror-horizontal.avif",
"av1-avif/testFiles/Link-U/kimono.mirror-vertical.avif",
@ -926,6 +929,16 @@ fn public_avif_unknown_mdat() {
);
}
#[test]
fn public_avif_unknown_mdat_in_oversized_meta() {
let input =
&mut File::open(IMAGE_AVIF_UNKNOWN_MDAT_SIZE_IN_OVERSIZED_META).expect("Unknown file");
assert_eq!(
Status::from(mp4::read_avif(input, ParseStrictness::Normal)),
Status::Unsupported
);
}
#[test]
fn public_avif_bug_1655846() {
let input = &mut File::open(IMAGE_AVIF_CORRUPT).expect("Unknown file");

Двоичные данные
third_party/rust/mp4parse/tests/unknown_mdat_in_oversized_meta.avif поставляемый Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -12,7 +12,7 @@ mozglue-static = { path = "../../../../mozglue/static/rust" }
geckoservo = { path = "../../../../servo/ports/geckolib" }
kvstore = { path = "../../../components/kvstore" }
lmdb-rkv-sys = { version = "0.11", features = ["mdb_idl_logn_9"] }
mp4parse_capi = { git = "https://github.com/mozilla/mp4parse-rust", rev = "40763b69d75e14abaa25c6438271eb552dc2b9e9", features = ["missing-pixi-permitted"] }
mp4parse_capi = { git = "https://github.com/mozilla/mp4parse-rust", rev = "2b572e83608a3d0867b935e076f45d9fe248069d", features = ["missing-pixi-permitted"] }
nserror = { path = "../../../../xpcom/rust/nserror" }
nsstring = { path = "../../../../xpcom/rust/nsstring" }
netwerk_helper = { path = "../../../../netwerk/base/rust-helper" }