[FFmpeg-devel] [PATCH] lavc/sunrastenc: consider cases with linesize < 0

Stefano Sabatini stefasab at gmail.com
Sun Mar 18 16:57:28 CET 2012


Make sunrast_image_write_image() deals with cases when linesize is < 0.
Fix trac ticket #1077.
---
 libavcodec/sunrastenc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sunrastenc.c b/libavcodec/sunrastenc.c
index a9b4749..84a3cdc 100644
--- a/libavcodec/sunrastenc.c
+++ b/libavcodec/sunrastenc.c
@@ -87,11 +87,11 @@ static void sunrast_image_write_image(AVCodecContext *avctx,
 
         ptr = pixels;
 
-#define GET_VALUE ptr >= end ? 0 : x >= len ? ptr[len-1] : ptr[x]
+#define GET_VALUE (linesize > 0 && ptr >= end) || ptr <= end ? 0 : x >= len ? ptr[len-1] : ptr[x]
 
         x = 0;
         value2 = GET_VALUE;
-        while (ptr < end) {
+        while ((linesize > 0 && ptr < end) || ptr > end) {
             run = 1;
             value = value2;
             x++;
-- 
1.7.5.4



More information about the ffmpeg-devel mailing list