1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00

lavc/xpmdec: Allow more colours per character.

Fixes ticket #6234.
This commit is contained in:
Carl Eugen Hoyos 2018-12-06 19:09:56 +01:00
parent 8affd753c8
commit fe300b2ab5

View 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);