summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Essick <essick@google.com>2018-02-06 11:25:31 -0800
committerTim Schumacher <timschumi@gmx.de>2018-04-06 19:54:07 +0200
commit2497fe83e2e4d028720fc19a9d94fbd80e45ea92 (patch)
tree9a686d4cd393074a88838466828ebb88e1268bf5
parentc37b251739f9559d4f6bcaa680b985f9cf8ff766 (diff)
downloadframeworks_av-2497fe83e2e4d028720fc19a9d94fbd80e45ea92.tar.gz
frameworks_av-2497fe83e2e4d028720fc19a9d94fbd80e45ea92.tar.bz2
frameworks_av-2497fe83e2e4d028720fc19a9d94fbd80e45ea92.zip
Check NAL size before looking inside
Add a check to ensure we have a non-zero size for a NAL while parsing before we crack said NAL open to see what type it is. Bug: 72117051 Test: compilation Change-Id: Iaa3ebb2daae5d9225060a11e9adbb6757a168656 Merged-In: I607c67a320b33b991476db30d78223cf4386c0e8 (cherry picked from commit e0c020969d88891b0b71bb938778e9ca762e8035)
-rw-r--r--media/libstagefright/avc_utils.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/media/libstagefright/avc_utils.cpp b/media/libstagefright/avc_utils.cpp
index bf014ba6af..19556cc2cf 100644
--- a/media/libstagefright/avc_utils.cpp
+++ b/media/libstagefright/avc_utils.cpp
@@ -304,7 +304,7 @@ static sp<ABuffer> FindNAL(const uint8_t *data, size_t size, unsigned nalType) {
const uint8_t *nalStart;
size_t nalSize;
while (getNextNALUnit(&data, &size, &nalStart, &nalSize, true) == OK) {
- if ((nalStart[0] & 0x1f) == nalType) {
+ if (nalSize > 0 && (nalStart[0] & 0x1f) == nalType) {
sp<ABuffer> buffer = new ABuffer(nalSize);
memcpy(buffer->data(), nalStart, nalSize);
return buffer;