[FFmpeg-devel] [PATCH] avcodec/dvbsubdec: Fix 8bit non_mod case

Michael Niedermayer michaelni at gmx.at
Thu Jul 31 14:43:30 CEST 2014


Untested, i failed to find a sample which triggers this case

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
 libavcodec/dvbsubdec.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index a40da76..1e1cc7e 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -747,11 +747,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++;
+                    }
                 }
             }
         }
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list