[xiph-commits] r2916 - liboggplay/trunk/src/liboggplay

shans at svn.annodex.net shans at svn.annodex.net
Wed Jun 13 18:21:23 PDT 2007


Author: shans
Date: 2007-06-13 18:21:22 -0700 (Wed, 13 Jun 2007)
New Revision: 2916

Modified:
   liboggplay/trunk/src/liboggplay/oggplay.c
Log:
Added timeouts on oggplay_step_decoding so that parsing of badly formed files still returns regularly to the controlling application



Modified: liboggplay/trunk/src/liboggplay/oggplay.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay.c	2007-06-14 01:20:18 UTC (rev 2915)
+++ liboggplay/trunk/src/liboggplay/oggplay.c	2007-06-14 01:21:22 UTC (rev 2916)
@@ -374,6 +374,8 @@
   return E_OGGPLAY_OK;
 }
 
+#define MAX_CHUNK_COUNT   10
+
 OggPlayErrorCode
 oggplay_step_decoding(OggPlay *me) {
 
@@ -385,6 +387,7 @@
   int                     r;
   int                     i;
   int                     need_data  = 0;
+  int                     chunk_count = 0;
 
   if (me == NULL) {
     return E_OGGPLAY_BAD_OGGPLAY;
@@ -447,6 +450,13 @@
      * have some final frames to render (?).  E_OGGPLAY_END_OF_FILE is
      * only returned if there is *no* more data.
      */
+
+    if (chunk_count > MAX_CHUNK_COUNT) {
+      return E_OGGPLAY_TIMEOUT;
+    }
+    
+    chunk_count += 1;
+
     if (me->reader->get_next_chunk(me->reader, &chunk_pos, &chunk_size, 
                    &chunk_base) == E_OGGPLAY_END_OF_FILE) {
       num_records = oggplay_callback_info_prepare(me, &info);



More information about the commits mailing list