[FFmpeg-cvslog] Check for oom in the dirac parser.

Carl Eugen Hoyos git at videolan.org
Thu Oct 2 09:43:13 CEST 2014


ffmpeg | branch: master | Carl Eugen Hoyos <cehoyos at ag.or.at> | Thu Oct  2 09:31:41 2014 +0200| [80ca627abb53d9e563f6ce9c52a05a50738a28d0] | committer: Carl Eugen Hoyos

Check for oom in the dirac parser.

Fixes ticket #3996.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=80ca627abb53d9e563f6ce9c52a05a50738a28d0
---

 libavcodec/dirac_parser.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
index 4119e3b..8b7c55e 100644
--- a/libavcodec/dirac_parser.c
+++ b/libavcodec/dirac_parser.c
@@ -139,6 +139,8 @@ static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,
         void *new_buffer =
             av_fast_realloc(pc->buffer, &pc->buffer_size,
                             pc->index + (*buf_size - pc->sync_offset));
+        if (!new_buffer)
+            return AVERROR(ENOMEM);
         pc->buffer = new_buffer;
         memcpy(pc->buffer + pc->index, (*buf + pc->sync_offset),
                *buf_size - pc->sync_offset);
@@ -149,6 +151,8 @@ static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,
         DiracParseUnit pu1, pu;
         void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size,
                                            pc->index + next);
+        if (!new_buffer)
+            return AVERROR(ENOMEM);
         pc->buffer = new_buffer;
         memcpy(pc->buffer + pc->index, *buf, next);
         pc->index += next;



More information about the ffmpeg-cvslog mailing list