[FFmpeg-cvslog] swscale: fix crash in 8-bpc bilinear output without alpha.

Ronald S. Bultje git at videolan.org
Mon Jul 11 04:13:00 CEST 2011


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Fri Jul  8 12:28:28 2011 -0700| [71a04bc19dfb990d3f7cce82b5516e88d2c371f4] | committer: Michael Niedermayer

swscale: fix crash in 8-bpc bilinear output without alpha.

We accessed the alpha array even it wasn't used and didn't
exist, hence leading to a NULL pointer segfault.
(cherry picked from commit bf2cba453244a74331238a472fe0e309f116f4d9)

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

 libswscale/swscale.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 15db836..b9c619c 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1247,7 +1247,8 @@ yuv2rgb_2_c_template(SwsContext *c, const int16_t *buf[2],
     const int16_t *buf0  = buf[0],  *buf1  = buf[1],
                   *ubuf0 = ubuf[0], *ubuf1 = ubuf[1],
                   *vbuf0 = vbuf[0], *vbuf1 = vbuf[1],
-                  *abuf0 = abuf[0], *abuf1 = abuf[1];
+                  *abuf0 = hasAlpha ? abuf[0] : NULL,
+                  *abuf1 = hasAlpha ? abuf[1] : NULL;
     int  yalpha1 = 4095 - yalpha;
     int uvalpha1 = 4095 - uvalpha;
     int i;



More information about the ffmpeg-cvslog mailing list