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
... | ... |
@@ -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; |