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

Commit 4005367e authored by Robert Shih's avatar Robert Shih Committed by Android Git Automerger
Browse files

am 84e4987f: Merge "MatroskaExtractor: detect infinite loop when parsing NALs" into mnc-dev

* commit '84e4987f':
  MatroskaExtractor: detect infinite loop when parsing NALs
parents c639f06e 84e4987f
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include "MatroskaExtractor.h"

#include <media/stagefright/foundation/ADebug.h>
#include <media/stagefright/foundation/AUtils.h>
#include <media/stagefright/foundation/hexdump.h>
#include <media/stagefright/DataSource.h>
#include <media/stagefright/MediaBuffer.h>
@@ -620,7 +621,12 @@ status_t MatroskaSource::read(
                    TRESPASS();
            }

            if (srcOffset + mNALSizeLen + NALsize > srcSize) {
            if (srcOffset + mNALSizeLen + NALsize <= srcOffset + mNALSizeLen) {
                frame->release();
                frame = NULL;

                return ERROR_MALFORMED;
            } else if (srcOffset + mNALSizeLen + NALsize > srcSize) {
                break;
            }