diff options
author | Anton Khirnov <anton@khirnov.net> | 2013-03-06 10:02:50 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-03-08 08:12:26 +0100 |
commit | 4c0080b7e7d501e2720d2a61f5186a18377f9d63 (patch) | |
tree | 4c2298aa76c04aa61942a104bc950653ec7504e4 | |
parent | cacad1c058f66558ec727faac3b277d2dee264d4 (diff) | |
download | ffmpeg-4c0080b7e7d501e2720d2a61f5186a18377f9d63.tar.gz |
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
-rw-r--r-- | libavcodec/wmaprodec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index d906f900f4..56bb83ce27 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1502,8 +1502,11 @@ static int decode_packet(AVCodecContext *avctx, void *data, s->packet_done = 0; /** sanity check for the buffer length */ - if (buf_size < avctx->block_align) - return 0; + if (buf_size < avctx->block_align) { + av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n", + buf_size, avctx->block_align); + return AVERROR_INVALIDDATA; + } s->next_packet_start = buf_size - avctx->block_align; buf_size = avctx->block_align; |