]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/xpmdec: fix small artifacts
authorPaul B Mahol <onemda@gmail.com>
Mon, 10 Dec 2018 20:31:18 +0000 (21:31 +0100)
committerPaul B Mahol <onemda@gmail.com>
Mon, 10 Dec 2018 20:31:18 +0000 (21:31 +0100)
The max size of uint8_t subset is 223 not 220.

libavcodec/xpmdec.c

index 1aa40c065503158b73f88c91aaa5f50e567fca7d..acde9e768d1144cbdade7dc0c6176d3a32b7c06b 100644 (file)
@@ -293,7 +293,7 @@ static int ascii2index(const uint8_t *cpixel, int cpp)
         if (*p < ' ' || *p > 0xfe)
             return AVERROR_INVALIDDATA;
         n += (*p++ - ' ') * m;
-        m *= 220;
+        m *= 223;
     }
     return n;
 }
@@ -346,7 +346,7 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data,
 
     size = 1;
     for (i = 0; i < cpp; i++)
-        size *= 220;
+        size *= 223;
 
     if (ncolors <= 0 || ncolors > size) {
         av_log(avctx, AV_LOG_ERROR, "invalid number of colors: %d\n", ncolors);