mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge remote-tracking branch 'qatar/master'
* qatar/master:
mjpeg: Check the unescaped size for overflows
Conflicts:
libavcodec/mjpegdec.c
See: a9456c7c5c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
afddf0d910
@ -1662,14 +1662,18 @@ int ff_mjpeg_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
|
|||||||
/* EOF */
|
/* EOF */
|
||||||
if (start_code < 0) {
|
if (start_code < 0) {
|
||||||
goto the_end;
|
goto the_end;
|
||||||
} else if (unescaped_buf_size > (1U<<28)) {
|
} else if (unescaped_buf_size > INT_MAX / 8) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "MJPEG packet 0x%x too big (0x%x/0x%x), corrupt data?\n",
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
|
"MJPEG packet 0x%x too big (%d/%d), corrupt data?\n",
|
||||||
start_code, unescaped_buf_size, buf_size);
|
start_code, unescaped_buf_size, buf_size);
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
}
|
}
|
||||||
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
|
av_log(avctx, AV_LOG_DEBUG, "marker=%x avail_size_in_buf=%td\n",
|
||||||
start_code, buf_end - buf_ptr);
|
start_code, buf_end - buf_ptr);
|
||||||
if ((ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size)) < 0) {
|
|
||||||
|
ret = init_get_bits8(&s->gb, unescaped_buf_ptr, unescaped_buf_size);
|
||||||
|
|
||||||
|
if (ret < 0) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "invalid buffer\n");
|
av_log(avctx, AV_LOG_ERROR, "invalid buffer\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user