shithub: opus

Download patch

ref: d32f94876ebde41c516eb04643ab9c482cad86ae
parent: e03af4423dcaef209627ca028c66973b5cc3c647
author: Gregory Maxwell <[email protected]>
date: Sun Sep 4 03:48:20 EDT 2011

Prevents OPUS_RESET_STATE from causing segfault.

--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -758,7 +758,7 @@
       celt_dec = (CELTDecoder*)((char*)st+st->celt_dec_offset);
 
       OPUS_CLEAR((char*)&st->OPUS_DECODER_RESET_START,
-            opus_decoder_get_size(st->channels)-
+            sizeof(OpusDecoder)-
             ((char*)&st->OPUS_DECODER_RESET_START - (char*)st));
 
       celt_decoder_ctl(celt_dec, OPUS_RESET_STATE);
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -1111,7 +1111,7 @@
            silk_enc = (char*)st+st->silk_enc_offset;
 
            OPUS_CLEAR((char*)&st->OPUS_ENCODER_RESET_START,
-                 opus_encoder_get_size(st->channels)-
+                 sizeof(OpusEncoder)-
                  ((char*)&st->OPUS_ENCODER_RESET_START - (char*)st));
 
            celt_encoder_ctl(celt_enc, OPUS_RESET_STATE);