[FFmpeg-cvslog] sws: check that dither array is not null before memset

Michael Niedermayer git at videolan.org
Sat Jan 19 23:44:33 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Jan 19 22:46:34 2013 +0100| [89afa635bf101e881ef7f70659f555806fdeae28] | committer: Michael Niedermayer

sws: check that dither array is not null before memset

Fixes null pointer dereference

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libswscale/swscale.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index bf0c130..8227ff5 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -910,7 +910,7 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
         src2[0] = base;
     }
 
-    if (!srcSliceY && (c->flags & SWS_BITEXACT) && (c->flags & SWS_ERROR_DIFFUSION))
+    if (!srcSliceY && (c->flags & SWS_BITEXACT) && (c->flags & SWS_ERROR_DIFFUSION) && c->dither_error[0])
         for (i = 0; i < 4; i++)
             memset(c->dither_error[i], 0, sizeof(c->dither_error[0][0]) * (c->dstW+2));
 



More information about the ffmpeg-cvslog mailing list