Catch input buffer too small

This commit is contained in:
Cameron Gutman
2017-11-28 19:33:34 -08:00
parent b37a2dea57
commit 284a31737e

View File

@@ -882,6 +882,16 @@ public class MediaCodecDecoderRenderer extends VideoDecoderRenderer {
}
}
if (decodeUnitLength > buf.limit() - buf.position()) {
IllegalArgumentException exception = new IllegalArgumentException(
"Decode unit length "+decodeUnitLength+" too large for input buffer "+buf.limit());
if (!reportedCrash) {
reportedCrash = true;
crashListener.notifyCrash(exception);
}
throw new RendererException(this, exception);
}
// Copy data from our buffer list into the input buffer
buf.put(decodeUnitData, 0, decodeUnitLength);