Browse code

wmaprodec: return an error, not 0, when the input is too small.

Returning 0 may result in an infinite loop in valid calling programs. A
decoder should never return 0 without producing any output.

CC:libav-stable@libav.org

Anton Khirnov authored on 2013/03/06 18:02:50
Showing 1 changed files
... ...
@@ -1502,8 +1502,11 @@ static int decode_packet(AVCodecContext *avctx, void *data,
1502 1502
         s->packet_done = 0;
1503 1503
 
1504 1504
         /** sanity check for the buffer length */
1505
-        if (buf_size < avctx->block_align)
1506
-            return 0;
1505
+        if (buf_size < avctx->block_align) {
1506
+            av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n",
1507
+                   buf_size, avctx->block_align);
1508
+            return AVERROR_INVALIDDATA;
1509
+        }
1507 1510
 
1508 1511
         s->next_packet_start = buf_size - avctx->block_align;
1509 1512
         buf_size = avctx->block_align;