jpeglsdec: fix infinite loop
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 8 Sep 2011 03:05:11 +0000 (05:05 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 21 Sep 2011 15:57:01 +0000 (17:57 +0200)
Fixes Ticket331

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bd358e128f47c14c7bc9dfceb8dedb3e5697f017)

libavcodec/jpegls.h

index 28c7524..2c21f77 100644 (file)
@@ -86,6 +86,8 @@ static inline void ff_jpegls_downscale_state(JLSState *state, int Q){
 }
 
 static inline int ff_jpegls_update_state_regular(JLSState *state, int Q, int err){
+    if(FFABS(err) > 0xFFFF)
+        return -0x10000;
     state->A[Q] += FFABS(err);
     err *= state->twonear;
     state->B[Q] += err;