summaryrefslogtreecommitdiffstats
path: root/libavcodec/wmaenc.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2013-05-13 21:38:20 +0200
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2013-05-29 22:31:16 +0200
commitdccaad3bcdc5762141527cb7db7c87f34517f097 (patch)
tree029f847d7c3894b6449baf65d996600cf29855be /libavcodec/wmaenc.c
parent38fefbc474affdbbac3ad53c2094fe56ddb105a0 (diff)
downloadffmpeg-streaming-dccaad3bcdc5762141527cb7db7c87f34517f097.zip
ffmpeg-streaming-dccaad3bcdc5762141527cb7db7c87f34517f097.tar.gz
wamenc: handle failure to encode.
This is necessary since the switch to floating point input means there is no longer sufficient input data validation. There is a good chance that other encoders are affected by similar issues. This problem can be triggered by trying to encode extremely large values and probably also with Inf and possibly also NaNs. Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/wmaenc.c')
-rw-r--r--libavcodec/wmaenc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index d061cde..8252f45 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -376,6 +376,11 @@ static int encode_superframe(AVCodecContext *avctx, AVPacket *avpkt,
while(total_gain <= 128 && error > 0)
error = encode_frame(s, s->coefs, avpkt->data, avpkt->size, total_gain++);
+ if (error > 0) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid input data or requested bitrate too low, cannot encode\n");
+ avpkt->size = 0;
+ return AVERROR(EINVAL);
+ }
av_assert0((put_bits_count(&s->pb) & 7) == 0);
i= avctx->block_align - (put_bits_count(&s->pb)+7)/8;
av_assert0(i>=0);
OpenPOWER on IntegriCloud