From e73325b971b37dd4741c49541c74cde0739dab8c Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Sun, 12 Mar 2017 15:07:02 +0100 Subject: [PATCH] avcodec/xpmdec: skip everything before signature Signed-off-by: Paul B Mahol --- libavcodec/xpmdec.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c index 8d5bc76ab2..6cd7bde4ec 100644 --- a/libavcodec/xpmdec.c +++ b/libavcodec/xpmdec.c @@ -309,7 +309,10 @@ static int xpm_decode_frame(AVCodecContext *avctx, void *data, avctx->pix_fmt = AV_PIX_FMT_BGRA; end = avpkt->data + avpkt->size; - if (memcmp(ptr, "/* XPM */", 9)) { + while (memcmp(ptr, "/* XPM */\n", 10) && ptr < end - 10) + ptr++; + + if (ptr >= end) { av_log(avctx, AV_LOG_ERROR, "missing signature\n"); return AVERROR_INVALIDDATA; }