Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2cdc2add authored by Shalaj Jain's avatar Shalaj Jain Committed by Ricardo Cerqueira
Browse files

libstagefright: Add check for zero chunk size.

mp4 file with chunksize of zero causes a infinite recursive call
of parsechunk of the parser resulting in ANR. Added check to handle
this case.

Change-Id: Id522da4c600600628e528a66b2a53468602020ce
Crs-Fixed:254974
parent 612a7ad1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -614,6 +614,9 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
    uint32_t chunk_type = ntohl(hdr[1]);
    off64_t data_offset = *offset + 8;

    if(chunk_size == 0)
       return ERROR_MALFORMED;

    if (chunk_size == 1) {
        if (mDataSource->readAt(*offset + 8, &chunk_size, 8) < 8) {
            return ERROR_IO;