[FFmpeg-cvslog] shorten: avoid abort() on unknown audio types

John Brooks git at videolan.org
Fri Dec 9 00:18:55 CET 2011


ffmpeg | branch: master | John Brooks <john.brooks at bluecherry.net> | Thu Dec  8 09:16:21 2011 +0000| [8562d9bd6c20d2ecee4f25d582cfd917f9da0d28] | committer: Janne Grunau

shorten: avoid abort() on unknown audio types

Signed-off-by: Janne Grunau <janne-libav at jannau.net>

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

 libavcodec/shorten.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 2170d59..eb67df7 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -176,7 +176,7 @@ static void fix_bitshift(ShortenContext *s, int32_t *buffer)
 }
 
 
-static void init_offset(ShortenContext *s)
+static int init_offset(ShortenContext *s)
 {
     int32_t mean = 0;
     int  chan, i;
@@ -190,12 +190,13 @@ static void init_offset(ShortenContext *s)
             break;
         default:
             av_log(s->avctx, AV_LOG_ERROR, "unknown audio type");
-            abort();
+            return AVERROR_INVALIDDATA;
     }
 
     for (chan = 0; chan < s->channels; chan++)
         for (i = 0; i < nblock; i++)
             s->offset[chan][i] = mean;
+    return 0;
 }
 
 static int decode_wave_header(AVCodecContext *avctx, const uint8_t *header,
@@ -367,7 +368,8 @@ static int read_header(ShortenContext *s)
     if ((ret = allocate_buffers(s)) < 0)
         return ret;
 
-    init_offset(s);
+    if ((ret = init_offset(s)) < 0)
+        return ret;
 
     if (s->version > 1)
         s->lpcqoffset = V2LPCQOFFSET;



More information about the ffmpeg-cvslog mailing list