[FFmpeg-devel] [PATCH] dpx: prevent segfault on malformed input

Peter Ross pross at xvid.org
Sat Nov 24 07:45:37 CET 2012


Signed-off-by: Peter Ross <pross at xvid.org>
---
 libavcodec/dpx.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index bfc88b6..3c5e753 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -76,6 +76,11 @@ static int decode_frame(AVCodecContext *avctx,
     unsigned int rgbBuffer = 0;
     int n_datum = 0;
 
+    if (avctx->width <= 0 || avctx->height <= 0) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid width or height\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     if (avpkt->size <= 1634) {
         av_log(avctx, AV_LOG_ERROR, "Packet too small for DPX header\n");
         return AVERROR_INVALIDDATA;
-- 
1.7.10.4

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121124/9d00b54d/attachment.asc>


More information about the ffmpeg-devel mailing list