[FFmpeg-cvslog] avcodec/xpmdec: skip everything before signature

Paul B Mahol git at videolan.org
Sun Mar 12 19:28:26 EET 2017


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Mar 12 15:07:02 2017 +0100| [e73325b971b37dd4741c49541c74cde0739dab8c] | committer: Paul B Mahol

avcodec/xpmdec: skip everything before signature

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e73325b971b37dd4741c49541c74cde0739dab8c
---

 libavcodec/xpmdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/xpmdec.c b/libavcodec/xpmdec.c
index 8d5bc76..6cd7bde 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;
     }



More information about the ffmpeg-cvslog mailing list