[FFmpeg-cvslog] smacker demuxer: handle possible av_realloc() failure.

Kostya Shishkov git at videolan.org
Sun Dec 25 01:36:00 CET 2011


ffmpeg | branch: release/0.6 | Kostya Shishkov <kostya.shishkov at gmail.com> | Mon Sep 12 09:40:42 2011 +0200| [f79f3a946f91de62d879b73410d80fd4e55ea28f] | committer: Reinhard Tartler

smacker demuxer: handle possible av_realloc() failure.

Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit 47a8589f7bc69d1a29da1dfdfbd0dfa78a9e31fd)

Signed-off-by: Anton Khirnov <anton at khirnov.net>
(cherry picked from commit 0b9b3570a3e3f3eff088ee061dbab165ff3eff2f)

Conflicts:

	libavformat/smacker.c

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

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

 libavformat/smacker.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/libavformat/smacker.c b/libavformat/smacker.c
index 0dcc286..056e9dc 100644
--- a/libavformat/smacker.c
+++ b/libavformat/smacker.c
@@ -289,10 +289,15 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
             if(flags & 1) {
                 int size;
                 size = get_le32(s->pb) - 4;
+                uint8_t *tmpbuf;
+
                 frame_size -= size;
                 frame_size -= 4;
                 smk->curstream++;
-                smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
+                tmpbuf = av_realloc(smk->bufs[smk->curstream], size);
+                if (!tmpbuf)
+                    return AVERROR(ENOMEM);
+                smk->bufs[smk->curstream] = tmpbuf;
                 smk->buf_sizes[smk->curstream] = size;
                 ret = get_buffer(s->pb, smk->bufs[smk->curstream], size);
                 if(ret != size)



More information about the ffmpeg-cvslog mailing list