avcodec/dvbsubdec: Fix 8bit non_mod case
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 31 Jul 2014 11:25:43 +0000 (13:25 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 11 Nov 2014 21:57:01 +0000 (22:57 +0100)
Untested, i failed to find a sample which triggers this case

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/dvbsubdec.c

index b1f953e..0b373e9 100644 (file)
@@ -741,11 +741,13 @@ static int dvbsub_read_8bit_string(uint8_t *destbuf, int dbuf_len,
 
                 if (non_mod == 1 && bits == 1)
                     pixels_read += run_length;
-                if (map_table)
-                    bits = map_table[bits];
-                else while (run_length-- > 0 && pixels_read < dbuf_len) {
-                    *destbuf++ = bits;
-                    pixels_read++;
+                else {
+                    if (map_table)
+                        bits = map_table[bits];
+                    while (run_length-- > 0 && pixels_read < dbuf_len) {
+                        *destbuf++ = bits;
+                        pixels_read++;
+                    }
                 }
             }
         }