зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1389470 - reduce table size on 32bit arch to avoid OOM. r=kinetik
MozReview-Commit-ID: C0O7Gnxbocy --HG-- extra : rebase_source : 6137aae1f8f981f84ea49a5b98adaed50353ff99
This commit is contained in:
Родитель
d113ce52dc
Коммит
40b0569eb5
|
@ -30,8 +30,13 @@ const BUF_SIZE_LIMIT: usize = 1024 * 1024;
|
|||
|
||||
// Max table length. Calculating in worth case for one week long video, one
|
||||
// frame per table entry in 30 fps.
|
||||
#[cfg(target_pointer_width = "64")]
|
||||
const TABLE_SIZE_LIMIT: u32 = 30 * 60 * 60 * 24 * 7;
|
||||
|
||||
// Reduce max table length if it is in 32 arch for memory problem.
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
const TABLE_SIZE_LIMIT: u32 = 30 * 60 * 60 * 24;
|
||||
|
||||
static DEBUG_MODE: std::sync::atomic::AtomicBool = std::sync::atomic::ATOMIC_BOOL_INIT;
|
||||
|
||||
pub fn set_debug_mode(mode: bool) {
|
||||
|
@ -1333,13 +1338,12 @@ fn find_descriptor(data: &[u8], esds: &mut ES_Descriptor) -> Result<()> {
|
|||
let tag = des.read_u8()?;
|
||||
|
||||
let mut end = 0;
|
||||
// Extension descriptor could be variable size from 0x80 to
|
||||
// 0x80 0x80 0x80, the descriptor length is the byte after that,
|
||||
// so it loops four times.
|
||||
// MSB of extend_or_len indicates more bytes, up to 4 bytes.
|
||||
for _ in 0..4 {
|
||||
let extend_or_len = des.read_u8()?;
|
||||
if extend_or_len < 0x80 {
|
||||
end = extend_or_len + des.position() as u8;
|
||||
end = (end << 7) + (extend_or_len & 0x7F);
|
||||
if (extend_or_len & 0x80) == 0 {
|
||||
end += des.position() as u8;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -974,6 +974,23 @@ fn read_esds_one_byte_extension_descriptor() {
|
|||
assert_eq!(es.audio_channel_count, Some(2));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_esds_byte_extension_descriptor() {
|
||||
let mut stream = make_box(BoxSize::Auto, b"esds", |s| {
|
||||
s.B32(0) // reserved
|
||||
.B16(0x0003)
|
||||
.B16(0x8181) // extension byte length 0x81
|
||||
.append_repeated(0, 0x81)
|
||||
});
|
||||
let mut iter = super::BoxIter::new(&mut stream);
|
||||
let mut stream = iter.next_box().unwrap().unwrap();
|
||||
|
||||
match super::read_esds(&mut stream) {
|
||||
Ok(_) => (),
|
||||
_ => panic!("fail to parse descriptor extension byte length"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn read_f4v_stsd() {
|
||||
let mut stream = make_box(BoxSize::Auto, b".mp3", |s| {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Script to update mp4parse-rust sources to latest upstream
|
||||
|
||||
# Default version.
|
||||
VER=7563263b6804a81986cc93b557fe05bd57fd57b3
|
||||
VER=1d2d69df3380139ee208f58181c73b1947c91ac2
|
||||
|
||||
# Accept version or commit from the command line.
|
||||
if test -n "$1"; then
|
||||
|
|
Загрузка…
Ссылка в новой задаче