diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 0e5509c74a4126efe86a793d40eb19c354b826cb..9d371de0c8b07e2a339c2da07a19b0e912e5d38e 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -1012,7 +1012,7 @@ static void zero_remaining(unsigned int b, unsigned int b_max,
     unsigned int count = 0;
 
     while (b < b_max)
-        count += div_blocks[b];
+        count += div_blocks[b++];
 
     if (count)
         memset(buf, 0, sizeof(*buf) * count);