1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-07-06 06:27:36 +02:00

avcodec/xpmdec: fix small artifacts

The max size of uint8_t subset is 223 not 220.
This commit is contained in:
Paul B Mahol
2018-12-10 21:31:18 +01:00
parent 6a20876b62
commit 00502370f6

View File

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