Prevents OPUS_RESET_STATE from causing segfault.
authorGregory Maxwell <greg@xiph.org>
Sun, 4 Sep 2011 11:48:20 +0000 (07:48 -0400)
committerGregory Maxwell <greg@xiph.org>
Sun, 4 Sep 2011 11:51:31 +0000 (07:51 -0400)
src/opus_decoder.c
src/opus_encoder.c

index 2a4823b..8d2d6a3 100644 (file)
@@ -758,7 +758,7 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...)
       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);
index 3e07c79..d81c89f 100644 (file)
@@ -1111,7 +1111,7 @@ int opus_encoder_ctl(OpusEncoder *st, int request, ...)
            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);