[FFmpeg-cvslog] assdec: check av_new_packet return value

Vittorio Giovara git at videolan.org
Wed Oct 29 22:21:38 CET 2014


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Fri Oct 24 13:15:40 2014 +0100| [e9ba3098319f78c91470c05da988d865491852c5] | committer: Vittorio Giovara

assdec: check av_new_packet return value

CC: libav-stable at libav.org
Bug-Id: CID 703626

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

 libavformat/assdec.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/assdec.c b/libavformat/assdec.c
index 7bd3d17..08c1222 100644
--- a/libavformat/assdec.c
+++ b/libavformat/assdec.c
@@ -151,6 +151,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     ASSContext *ass = s->priv_data;
     uint8_t *p, *end;
+    int ret;
 
     if (ass->event_index >= ass->event_count)
         return AVERROR(EIO);
@@ -158,7 +159,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     p = ass->event[ass->event_index];
 
     end = strchr(p, '\n');
-    av_new_packet(pkt, end ? end - p + 1 : strlen(p));
+    ret = av_new_packet(pkt, end ? end - p + 1 : strlen(p));
+    if (ret < 0)
+        return ret;
     pkt->flags |= AV_PKT_FLAG_KEY;
     pkt->pos    = p - ass->event_buffer + s->streams[0]->codec->extradata_size;
     pkt->pts    = pkt->dts = get_pts(p);



More information about the ffmpeg-cvslog mailing list