diff options
author | 2010-06-24 13:14:37 -0700 | |
---|---|---|
committer | 2010-06-24 13:14:38 -0700 | |
commit | 7b5b27ada12d3680dec20274fa655fd7f73f839e (patch) | |
tree | 4394cb190f5f8e1181c5f0b0c3b7ff840ca34852 | |
parent | e57c3a88b99856d1e69fdf115e7c7954594b7385 (diff) | |
parent | 736c22d3e0b96a45e46ce43ac20a48ecbc373db7 (diff) |
Merge "Properly identify malformed (too short) chunks in mpeg4 files." into gingerbread
-rw-r--r-- | media/libstagefright/MPEG4Extractor.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 3639db40b346..0c2f1e6f3e53 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -428,6 +428,14 @@ status_t MPEG4Extractor::parseChunk(off_t *offset, int depth) { } chunk_size = ntoh64(chunk_size); data_offset += 8; + + if (chunk_size < 16) { + // The smallest valid chunk is 16 bytes long in this case. + return ERROR_MALFORMED; + } + } else if (chunk_size < 8) { + // The smallest valid chunk is 8 bytes long. + return ERROR_MALFORMED; } char chunk[5]; |