aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input/aac/aacfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input/aac/aacfile.cpp')
-rw-r--r--src/plugins/Input/aac/aacfile.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/Input/aac/aacfile.cpp b/src/plugins/Input/aac/aacfile.cpp
index c7fee32a7..288d4c3ca 100644
--- a/src/plugins/Input/aac/aacfile.cpp
+++ b/src/plugins/Input/aac/aacfile.cpp
@@ -70,7 +70,21 @@ AACFile::AACFile(QIODevice *i, bool metaData, bool adts)
//try to determnate header type;
if (buf[adts_offset] == 0xff && ((buf[adts_offset+1] & 0xf6) == 0xf0))
{
- qDebug("AACFile: ADTS header found");
+ int frame_length = ((((unsigned int)buf[adts_offset+3] & 0x3)) << 11)
+ | (((unsigned int)buf[adts_offset+4]) << 3) | (buf[adts_offset+5] >> 5);
+
+ if(adts_offset + frame_length > buf_at - 6)
+ break;
+
+ //check second sync word
+ if ((buf[adts_offset + frame_length] == 0xFF) &&
+ ((buf[adts_offset + frame_length + 1] & 0xF6) == 0xF0))
+ {
+ qDebug("AACFile: ADTS header found");
+ }
+ else
+ break;
+
if (!i->isSequential() && adts)
parseADTS();
m_isValid = true;