diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c
index 355bb32e1bba3e86418741f8b9dde216d37aabec..6fcadb16c9c45d800ef9b1af4720a101ec1e6090 100644
--- a/libavcodec/mss2.c
+++ b/libavcodec/mss2.c
@@ -416,7 +416,13 @@ static int decode_wmv9(AVCodecContext *avctx, const uint8_t *buf, int buf_size,
 
     ff_vc1_decode_blocks(v);
 
-    ff_er_frame_end(&s->er);
+    if (v->end_mb_x == s->mb_width && s->end_mb_y == s->mb_height) {
+        ff_er_frame_end(&s->er);
+    } else {
+        av_log(v->s.avctx, AV_LOG_WARNING,
+               "disabling error correction due to block count mismatch %dx%d != %dx%d\n",
+               v->end_mb_x, s->end_mb_y, s->mb_width, s->mb_height);
+    }
 
     ff_mpv_frame_end(s);