Commit f7fbbe99 by eguven Committed by Oliver Woodman

Fix ArrayIndexOutOfBoundsException while reading SEI NAL unit

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=147165453
parent ef475eb9
...@@ -1087,12 +1087,12 @@ public final class FragmentedMp4Extractor implements Extractor { ...@@ -1087,12 +1087,12 @@ public final class FragmentedMp4Extractor implements Extractor {
sampleBytesWritten += 4; sampleBytesWritten += 4;
sampleSize += nalUnitLengthFieldLengthDiff; sampleSize += nalUnitLengthFieldLengthDiff;
if (cea608TrackOutput != null) { if (cea608TrackOutput != null) {
byte[] nalPayloadData = nalPayload.data;
// Peek the NAL unit type byte. // Peek the NAL unit type byte.
input.peekFully(nalPayloadData, 0, 1); input.peekFully(nalPayload.data, 0, 1);
if ((nalPayloadData[0] & 0x1F) == NAL_UNIT_TYPE_SEI) { if ((nalPayload.data[0] & 0x1F) == NAL_UNIT_TYPE_SEI) {
// Read the whole SEI NAL unit into nalWrapper, including the NAL unit type byte. // Read the whole SEI NAL unit into nalWrapper, including the NAL unit type byte.
nalPayload.reset(sampleCurrentNalBytesRemaining); nalPayload.reset(sampleCurrentNalBytesRemaining);
byte[] nalPayloadData = nalPayload.data;
input.readFully(nalPayloadData, 0, sampleCurrentNalBytesRemaining); input.readFully(nalPayloadData, 0, sampleCurrentNalBytesRemaining);
// Write the SEI unit straight to the output. // Write the SEI unit straight to the output.
output.sampleData(nalPayload, sampleCurrentNalBytesRemaining); output.sampleData(nalPayload, sampleCurrentNalBytesRemaining);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment