Gracefully handle missing format in pss processing
Bug: 243222985
Test: re-fuzz
Change-Id: I217fe83e11b6fa75993afa180bce39c07921dd45
diff --git a/media/ndk/NdkMediaExtractor.cpp b/media/ndk/NdkMediaExtractor.cpp
index 6d3c348..386e42c 100644
--- a/media/ndk/NdkMediaExtractor.cpp
+++ b/media/ndk/NdkMediaExtractor.cpp
@@ -125,6 +125,7 @@
AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor *mData) {
sp<AMessage> format;
mData->mImpl->getFileFormat(&format);
+ // ignore any error, we want to return the empty format
return AMediaFormat_fromMsg(&format);
}
@@ -247,7 +248,10 @@
}
sp<AMessage> format;
- ex->mImpl->getFileFormat(&format);
+ if (ex->mImpl->getFileFormat(&format) != OK) {
+ android_errorWriteWithInfoLog(0x534e4554, "243222985", -1, nullptr, 0);
+ return NULL;
+ }
sp<ABuffer> buffer;
if(!format->findBuffer("pssh", &buffer)) {
return NULL;