Fix infinite loop in AdtsExtractor sniffing malformed or non-ADTS streams.

Here is a WAV that exhibits this issue:
https://storage.googleapis.com/courtside-public/dcower/reaper_16bit_nonbwf.wav
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=120334203
This commit is contained in:
olly 2016-04-20 07:19:11 -07:00 committed by Oliver Woodman
parent 157f5ff886
commit 6635dd0ef7

View file

@ -102,6 +102,10 @@ public final class AdtsExtractor implements Extractor {
input.peekFully(scratch.data, 0, 4);
scratchBits.setPosition(14);
int frameSize = scratchBits.readBits(13);
// Either the stream is malformed OR we're not parsing an ADTS stream.
if (frameSize <= 6) {
return false;
}
input.advancePeekPosition(frameSize - 6);
validFramesSize += frameSize;
}