mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-11 01:25:25 +00:00
mjpegdec: use av_fast_padded_malloc()
also check for allocation failure Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
This commit is contained in:
parent
2f4b9021a1
commit
0880503fbb
@ -1359,13 +1359,9 @@ int ff_mjpeg_find_marker(MJpegDecodeContext *s,
|
||||
int start_code;
|
||||
start_code = find_marker(buf_ptr, buf_end);
|
||||
|
||||
if ((buf_end - *buf_ptr) > s->buffer_size) {
|
||||
av_free(s->buffer);
|
||||
s->buffer_size = buf_end - *buf_ptr;
|
||||
s->buffer = av_malloc(s->buffer_size + FF_INPUT_BUFFER_PADDING_SIZE);
|
||||
av_log(s->avctx, AV_LOG_DEBUG,
|
||||
"buffer too small, expanding to %d bytes\n", s->buffer_size);
|
||||
}
|
||||
av_fast_padded_malloc(&s->buffer, &s->buffer_size, buf_end - *buf_ptr);
|
||||
if (!s->buffer)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
/* unescape buffer of SOS, use special treatment for JPEG-LS */
|
||||
if (start_code == SOS && !s->ls) {
|
||||
|
Loading…
Reference in New Issue
Block a user