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 Oliver Woodman
parent 62829be1ce
commit fc2e4ef4fa

View File

@ -657,6 +657,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) {