aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/alac.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2016-08-14 10:18:39 +0200
committerAnton Khirnov <anton@khirnov.net>2016-08-18 17:06:46 +0200
commit796dca027be09334d7bbf4f2ac1200e06bb054cb (patch)
treecc9112eb6bb73beae6e6bf066508483a1addae06 /libavcodec/alac.c
parentf5d46d332258dcd8ca623019ece1d5e5bb74142b (diff)
downloadffmpeg-796dca027be09334d7bbf4f2ac1200e06bb054cb.tar.gz
alac: do not return success if nothing was decoded
If we encounter an END element before anything is decoded, we would return success even though the output frame has not been allocated, which is invalid. CC: libav-stable@libav.org Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Diffstat (limited to 'libavcodec/alac.c')
-rw-r--r--libavcodec/alac.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index 1f24e1b41c..0d2a7ca01d 100644
--- a/libavcodec/alac.c
+++ b/libavcodec/alac.c
@@ -447,6 +447,10 @@ static int alac_decode_frame(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "no end tag found. incomplete packet.\n");
return AVERROR_INVALIDDATA;
}
+ if (!alac->nb_samples) {
+ av_log(avctx, AV_LOG_ERROR, "No decodable data in the packet\n");
+ return AVERROR_INVALIDDATA;
+ }
if (avpkt->size * 8 - get_bits_count(&alac->gb) > 8) {
av_log(avctx, AV_LOG_ERROR, "Error : %d bits left\n",