[xiph-cvs] cvs commit: speex/libspeex sb_celp.c

Jean-Marc Valin jm at xiph.org
Mon Dec 30 19:25:36 PST 2002



jm          02/12/30 22:25:35

  Modified:    libspeex sb_celp.c
  Log:
  Fixed a segfault in wideband/ultra-wideband decoding when a packet is
  lost while in NULL mode.

Revision  Changes    Path
1.107     +25 -22    speex/libspeex/sb_celp.c

Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- sb_celp.c	20 Dec 2002 08:24:46 -0000	1.106
+++ sb_celp.c	31 Dec 2002 03:25:34 -0000	1.107
@@ -912,29 +912,32 @@
       return ret;
    }
 
-   if (!bits)
+   if (bits || st->submodes[st->submodeID] != NULL)
    {
-      sb_decode_lost(st, out, 0, stack);
-      return 0;
-   }
-
-   /*Check "wideband bit"*/
-   wideband = speex_bits_peek(bits);
-   if (wideband)
-   {
-      /*Regular wideband frame, read the submode*/
-      wideband = speex_bits_unpack_unsigned(bits, 1);
-      st->submodeID = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-   } else
-   {
-      /*Was a narrowband frame, set "null submode"*/
-      st->submodeID = 0;
-   }
-
-   if (dtx)
-   {
-      sb_decode_lost(st, out, 1, stack);
-      return 0;      
+      if (!bits)
+      {
+         sb_decode_lost(st, out, 0, stack);
+         return 0;
+      }
+      
+      /*Check "wideband bit"*/
+      wideband = speex_bits_peek(bits);
+      if (wideband)
+      {
+         /*Regular wideband frame, read the submode*/
+         wideband = speex_bits_unpack_unsigned(bits, 1);
+         st->submodeID = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
+      } else
+      {
+         /*Was a narrowband frame, set "null submode"*/
+         st->submodeID = 0;
+      }
+      
+      if (dtx)
+      {
+         sb_decode_lost(st, out, 1, stack);
+         return 0;      
+      }
    }
 
    for (i=0;i<st->frame_size;i++)

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list