[FFmpeg-devel] [PATCH] nutdec: check return value of av_new_packet()

Paul B Mahol onemda at gmail.com
Mon Oct 15 17:24:07 CEST 2012


Fixes CID733173.

Signed-off-by: Paul B Mahol <onemda at gmail.com>
---
 libavformat/nutdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index cc18adc..492d5c8 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -854,7 +854,8 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code)
         return 1;
     }
 
-    av_new_packet(pkt, size + nut->header_len[header_idx]);
+    if (av_new_packet(pkt, size + nut->header_len[header_idx]) < 0)
+        return AVERROR(ENOMEM);
     memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
     pkt->pos = avio_tell(bc); // FIXME
     avio_read(bc, pkt->data + nut->header_len[header_idx], size);
-- 
1.7.11.4



More information about the ffmpeg-devel mailing list