changeset 6745:da3fecf31fa9 libavcodec

Do not read out of array bounds.
author ramiro
date Sun, 04 May 2008 01:07:46 +0000
parents cb04861f9e45
children 459562f7f2ce
files flac.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flac.c	Sat May 03 21:06:55 2008 +0000
+++ b/flac.c	Sun May 04 01:07:46 2008 +0000
@@ -279,9 +279,13 @@
     if (decode_residuals(s, channel, pred_order) < 0)
         return -1;
 
+    if(pred_order > 0)
     a = decoded[pred_order-1];
+    if(pred_order > 1)
     b = a - decoded[pred_order-2];
+    if(pred_order > 2)
     c = b - decoded[pred_order-2] + decoded[pred_order-3];
+    if(pred_order > 3)
     d = c - decoded[pred_order-2] + 2*decoded[pred_order-3] - decoded[pred_order-4];
 
     switch(pred_order)