summaryrefslogtreecommitdiffstats
path: root/audio_utils/spdif/AC3FrameScanner.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'audio_utils/spdif/AC3FrameScanner.cpp')
-rw-r--r--audio_utils/spdif/AC3FrameScanner.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/audio_utils/spdif/AC3FrameScanner.cpp b/audio_utils/spdif/AC3FrameScanner.cpp
index 6ebe9e3..3cd9d15 100644
--- a/audio_utils/spdif/AC3FrameScanner.cpp
+++ b/audio_utils/spdif/AC3FrameScanner.cpp
@@ -194,7 +194,13 @@ bool AC3FrameScanner::parseHeader()
// Frame size is explicit in EAC3. Paragraph E2.3.1.3
uint32_t frmsiz = ((mHeaderBuffer[2] & 0x07) << 8) + mHeaderBuffer[3];
- mFrameSizeBytes = (frmsiz + 1) * sizeof(int16_t);
+ uint32_t frameSizeBytes = (frmsiz + 1) * sizeof(int16_t);
+ if (frameSizeBytes < mHeaderLength) {
+ ALOGW("AC3 frame size = %d, less than header size = %d", frameSizeBytes, mHeaderLength);
+ android_errorWriteLog(0x534e4554, "145262423");
+ return false;
+ }
+ mFrameSizeBytes = frameSizeBytes;
uint32_t numblkscod = 3; // 6 blocks default
if (fscod == 3) {