diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 782a1b8b80cbbaab254aa4576283320d9fd4538b..f7dee7de1294cd53ea5e532a390506bb86680038 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1376,6 +1376,11 @@ static int read_frame_data(ALSDecContext *ctx, unsigned int ra_frame)
 
         for (b = 0; b < ctx->num_blocks; b++) {
             bd.block_length = div_blocks[b];
+            if (bd.block_length <= 0) {
+                av_log(ctx->avctx, AV_LOG_WARNING,
+                       "Invalid block length %d in channel data!\n", bd.block_length);
+                continue;
+            }
 
             for (c = 0; c < avctx->channels; c++) {
                 bd.const_block = ctx->const_block + c;