h264: check for out of bounds reads in ff_h264_decode_extradata().
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit d1186ff72d)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
committed by
Reinhard Tartler
parent
958e0f705d
commit
ec2a1d91e2
@@ -1032,6 +1032,8 @@ int ff_h264_decode_extradata(H264Context *h)
|
||||
p += 6;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
nalsize = AV_RB16(p) + 2;
|
||||
if (p - avctx->extradata + nalsize > avctx->extradata_size)
|
||||
return -1;
|
||||
if(decode_nal_units(h, p, nalsize) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i);
|
||||
return -1;
|
||||
@@ -1042,6 +1044,8 @@ int ff_h264_decode_extradata(H264Context *h)
|
||||
cnt = *(p++); // Number of pps
|
||||
for (i = 0; i < cnt; i++) {
|
||||
nalsize = AV_RB16(p) + 2;
|
||||
if (p - avctx->extradata + nalsize > avctx->extradata_size)
|
||||
return -1;
|
||||
if (decode_nal_units(h, p, nalsize) < 0) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user