[FFmpeg-cvslog] qdm2: print error messages instead of just retunring failures

Michael Niedermayer git at videolan.org
Tue May 8 23:35:19 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue May  8 23:09:45 2012 +0200| [66337bf9d58af031a91ef05ecc6ec97b644c9c58] | committer: Michael Niedermayer

qdm2: print error messages instead of just retunring failures

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66337bf9d58af031a91ef05ecc6ec97b644c9c58
---

 libavcodec/qdm2.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c
index a71de72..7a5d072 100644
--- a/libavcodec/qdm2.c
+++ b/libavcodec/qdm2.c
@@ -888,8 +888,10 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
                     case 30:
                         if (get_bits_left(gb) >= 4) {
                             unsigned index = qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1);
-                            if (index >= FF_ARRAY_ELEMS(type30_dequant))
+                            if (index >= FF_ARRAY_ELEMS(type30_dequant)) {
+                                av_log(NULL, AV_LOG_ERROR, "index %d out of type30_dequant array\n", index);
                                 return AVERROR_INVALIDDATA;
+                            }
                             samples[0] = type30_dequant[index];
                         } else
                             samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
@@ -906,8 +908,10 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
                                 type34_first = 0;
                             } else {
                                 unsigned index = qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1);
-                                if (index >= FF_ARRAY_ELEMS(type34_delta))
+                                if (index >= FF_ARRAY_ELEMS(type34_delta)) {
+                                    av_log(NULL, AV_LOG_ERROR, "index %d out of type34_delta array\n", index);
                                     return AVERROR_INVALIDDATA;
+                                }
                                 samples[0] = type34_delta[index] / type34_div + type34_predictor;
                                 type34_predictor = samples[0];
                             }
@@ -1834,8 +1838,10 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
 
     avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);
     extradata += 4;
-    if (s->channels > MPA_MAX_CHANNELS)
+    if (s->channels > MPA_MAX_CHANNELS) {
+        av_log(avctx, AV_LOG_ERROR, "Too many channels\n");
         return AVERROR_INVALIDDATA;
+    }
 
     avctx->sample_rate = AV_RB32(extradata);
     extradata += 4;



More information about the ffmpeg-cvslog mailing list