[vlc-commits] spudec: fix potential buffer underflow

Rémi Denis-Courmont git at videolan.org
Sun Apr 13 09:50:49 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 13 10:40:19 2014 +0300| [5631d28015bc5b9db7d4c0b1f5e791a434c738c4] | committer: Rémi Denis-Courmont

spudec: fix potential buffer underflow

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5631d28015bc5b9db7d4c0b1f5e791a434c738c4
---

 modules/codec/spudec/parse.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/codec/spudec/parse.c b/modules/codec/spudec/parse.c
index 3ad2916..ccc8cb6 100644
--- a/modules/codec/spudec/parse.c
+++ b/modules/codec/spudec/parse.c
@@ -623,10 +623,13 @@ static int ParseRLE( decoder_t *p_dec,
         int i, i_inner = -1, i_shade = -1;
 
         /* Set the border color */
-        p_spu_data->pi_yuv[i_border][0] = 0x00;
-        p_spu_data->pi_yuv[i_border][1] = 0x80;
-        p_spu_data->pi_yuv[i_border][2] = 0x80;
-        stats[i_border] = 0;
+        if( i_border != -1 )
+        {
+            p_spu_data->pi_yuv[i_border][0] = 0x00;
+            p_spu_data->pi_yuv[i_border][1] = 0x80;
+            p_spu_data->pi_yuv[i_border][2] = 0x80;
+            stats[i_border] = 0;
+        }
 
         /* Find the inner colors */
         for( i = 0 ; i < 4 && i_inner == -1 ; i++ )



More information about the vlc-commits mailing list