diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 056c7d90f6b48f15f67e92110b169eda439ab364..8c2fab7a27ab2255bd8c7851f677aa380a7d697a 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -1051,7 +1051,7 @@ static av_cold int cook_decode_init(AVCodecContext *avctx)
     q->avctx = avctx;
 
     /* Take care of the codec specific extradata. */
-    if (extradata_size <= 0) {
+    if (extradata_size < 8) {
         av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n");
         return AVERROR_INVALIDDATA;
     }