]> git.sesse.net Git - ffmpeg/commitdiff
lavc/xpmdec: Allow more colours per character.
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>
Thu, 6 Dec 2018 18:09:56 +0000 (19:09 +0100)
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>
Mon, 10 Dec 2018 19:59:08 +0000 (20:59 +0100)
Fixes ticket #6234.

libavcodec/xpmdec.c

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