diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-03-06 04:56:13 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-03-06 04:56:13 +0400 |
commit | c7921088292675c5f6691193a32fff68f36bf296 (patch) | |
tree | 8414a5447558b02af4e5762aa84281260328a6df /src/opus_decoder.c | |
parent | c0387ff23739cb450eb41acd078763dd7ab9ec94 (diff) |
Adds missing RESTORE_STACK statements on error paths
Thanks to Vincent Penquerc'h
Diffstat (limited to 'src/opus_decoder.c')
-rw-r--r-- | src/opus_decoder.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/opus_decoder.c b/src/opus_decoder.c index ed2f8c73..b06725e2 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -218,7 +218,10 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, F5 = F10>>1; F2_5 = F5>>1; if (frame_size < F2_5) + { + RESTORE_STACK; return OPUS_BUFFER_TOO_SMALL; + } /* Payloads of 1 (2 including ToC) or 0 trigger the PLC/DTX */ if (len<=1) { @@ -253,7 +256,10 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data, do { int ret = opus_decode_frame(st, NULL, 0, pcm, F20, 0); if (ret != F20) + { + RESTORE_STACK; return OPUS_INTERNAL_ERROR; + } pcm += F20*st->channels; nb_samples += F20; } while (nb_samples < frame_size); @@ -767,7 +773,11 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, int ret, i; ALLOC_STACK; - if(frame_size<0)return OPUS_BAD_ARG; + if(frame_size<0) + { + RESTORE_STACK; + return OPUS_BAD_ARG; + } ALLOC(out, frame_size*st->channels, float); |