diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 20c21263b55dfef33b387f45ae33156eb6a56288..b4c7b3c6d83b12290d563917d2476fd92cafe902 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -137,7 +137,8 @@ static int raw_decode(AVCodecContext *avctx,
         buf= dst;
     }
 
-    if(avctx->codec_tag == MKTAG('A', 'V', '1', 'x'))
+    if(avctx->codec_tag == MKTAG('A', 'V', '1', 'x') ||
+       avctx->codec_tag == MKTAG('A', 'V', 'u', 'p'))
         buf += buf_size - context->length;
 
     if(buf_size < context->length - (avctx->pix_fmt==PIX_FMT_PAL8 ? 256*4 : 0))