[FFmpeg-devel] [PATCH 2/2] assdec: fix wrong alloc pointer check.

Clément Bœsch ubitux at gmail.com
Sun Jan 29 15:03:24 CET 2012


---
That allocation check looks wrong. OTOH, I'm wondering if there won't be issues
if extradata_size is zero and/or extradata buffer isn't allocated...
---
 libavcodec/assdec.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c
index 087a0c8..c5f9cab 100644
--- a/libavcodec/assdec.c
+++ b/libavcodec/assdec.c
@@ -26,7 +26,7 @@
 static av_cold int ass_decode_init(AVCodecContext *avctx)
 {
     avctx->subtitle_header = av_malloc(avctx->extradata_size);
-    if (!avctx->extradata)
+    if (!avctx->subtitle_header)
         return AVERROR(ENOMEM);
     memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
     avctx->subtitle_header_size = avctx->extradata_size;
-- 
1.7.8.4



More information about the ffmpeg-devel mailing list