diff --git a/libavcodec/xbmdec.c b/libavcodec/xbmdec.c
index 629a636e6ada517078da301a65c88b6836ad6d10..b3e4cf2f89e651f0a313d70272fbb7d60e7d3281 100644
--- a/libavcodec/xbmdec.c
+++ b/libavcodec/xbmdec.c
@@ -83,6 +83,9 @@ static int xbm_decode_frame(AVCodecContext *avctx, void *data,
     if ((ret = avctx->get_buffer(avctx, p)) < 0)
         return ret;
 
+    // goto start of image data
+    ptr += strcspn(ptr, "{") + 1;
+
     linesize = (avctx->width + 7) / 8;
     for (i = 0; i < avctx->height; i++) {
         dst = p->data[0] + i * p->linesize[0];