diff -ru libav-9.1.orig/libavcodec/alac.c libav-9.1/libavcodec/alac.c
--- libav-9.1.orig/libavcodec/alac.c	2013-01-07 11:17:21.000000000 +0100
+++ libav-9.1/libavcodec/alac.c	2013-02-22 17:25:36.187354870 +0100
@@ -412,6 +412,10 @@
             got_end = 1;
             break;
         }
+
+        if (ch >= alac->channels)
+            break;
+
         if (element > TYPE_CPE && element != TYPE_LFE) {
             av_log(avctx, AV_LOG_ERROR, "syntax element unsupported: %d", element);
             return AVERROR_PATCHWELCOME;
@@ -431,7 +435,8 @@
 
         ch += channels;
     }
-    if (!got_end) {
+
+    if (!got_end && ch < alac->channels) {
         av_log(avctx, AV_LOG_ERROR, "no end tag found. incomplete packet.\n");
         return AVERROR_INVALIDDATA;
     }
