TS EsInfo: Be robust against a invalid descriptor length

Issue: Issue: #7722
PiperOrigin-RevId: 325431839
This commit is contained in:
olly 2020-08-07 15:26:21 +01:00 committed by kim-vde
parent 03a1a3ee82
commit 7f6940fb8b

View File

@ -666,6 +666,10 @@ public final class TsExtractor implements Extractor {
int descriptorTag = data.readUnsignedByte();
int descriptorLength = data.readUnsignedByte();
int positionOfNextDescriptor = data.getPosition() + descriptorLength;
if (positionOfNextDescriptor > descriptorsEndPosition) {
// Descriptor claims to extend past the end position. Skip it.
break;
}
if (descriptorTag == TS_PMT_DESC_REGISTRATION) { // registration_descriptor
long formatIdentifier = data.readUnsignedInt();
if (formatIdentifier == AC3_FORMAT_IDENTIFIER) {