aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-10 12:24:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-10 12:28:07 +0200
commita3d9a21683557d1e6c4c4018eb7979a9504fff0d (patch)
tree1dd810e48ad639145362750caabb68f8012ab09a
parent40e8967ee161a9d247419e77da745e939f0ddaf8 (diff)
parentbbf6a4aa20bfe3d7869b2218e66063602dfb8aa7 (diff)
downloadffmpeg-a3d9a21683557d1e6c4c4018eb7979a9504fff0d.tar.gz
Merge commit 'bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7'
* commit 'bbf6a4aa20bfe3d7869b2218e66063602dfb8aa7': imc: Catch a division by zero atrac3: Error on impossible encoding/channel combinations See: 13451f5520ce6b0afde861b2285dda659f8d4fb4 Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/atrac3.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c
index 0b56352517..2a46a0536e 100644
--- a/libavcodec/atrac3.c
+++ b/libavcodec/atrac3.c
@@ -923,11 +923,6 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
- if (q->coding_mode == JOINT_STEREO && avctx->channels < 2) {
- av_log(avctx, AV_LOG_ERROR, "Invalid coding mode\n");
- return AVERROR_INVALIDDATA;
- }
-
/* Check the extradata */
if (version != 4) {
@@ -950,9 +945,13 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx)
if (q->coding_mode == STEREO)
av_log(avctx, AV_LOG_DEBUG, "Normal stereo detected.\n");
- else if (q->coding_mode == JOINT_STEREO)
+ else if (q->coding_mode == JOINT_STEREO) {
+ if (avctx->channels != 2) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid coding mode\n");
+ return AVERROR_INVALIDDATA;
+ }
av_log(avctx, AV_LOG_DEBUG, "Joint stereo detected.\n");
- else {
+ } else {
av_log(avctx, AV_LOG_ERROR, "Unknown channel coding mode %x!\n",
q->coding_mode);
return AVERROR_INVALIDDATA;