diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index a178eb2d89eaacf3b28c5bef59907973fc19b38a..0e7db9850e6acba7ba4332f0afff67a0f61f4a24 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -363,6 +363,8 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p
             return AVERROR_EOF;
 
         len = get_le32(pb);
+        if (len < 32)
+            break;
         sid = get_le32(pb) & 0x7FFF;
         url_fskip(pb, 8);
         consumed = 32;