[xiph-commits] r3673 - in liboggplay/trunk/src: liboggplay tools

doublec at svn.annodex.net doublec at svn.annodex.net
Fri Aug 1 02:47:05 PDT 2008


Author: doublec
Date: 2008-08-01 02:47:05 -0700 (Fri, 01 Aug 2008)
New Revision: 3673

Modified:
   liboggplay/trunk/src/liboggplay/oggplay_callback.c
   liboggplay/trunk/src/tools/oggplay-info.c
Log:
Check return values of libtheora functions. Annodex ticket 409.

Modified: liboggplay/trunk/src/liboggplay/oggplay_callback.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_callback.c	2008-07-31 16:30:50 UTC (rev 3672)
+++ liboggplay/trunk/src/liboggplay/oggplay_callback.c	2008-08-01 09:47:05 UTC (rev 3673)
@@ -93,7 +93,9 @@
    * always decode headers
    */
   if (theora_packet_isheader(op)) {
-    theora_decode_header(&(decoder->video_info), &(decoder->video_comment), op);
+    if (theora_decode_header(&(decoder->video_info), &(decoder->video_comment), op) < 0)
+      return -1;
+
     /*
      * initialise width/stride/height data (this is common to all frames).
      * Use the buffer stride for the width to avoid passing negative stride
@@ -108,6 +110,13 @@
     }
     return 0;
   } 
+  else if (decoder->remaining_header_packets != 0) {
+    /*
+     * Invalid Ogg file. Missing headers
+     *
+     */
+    return -1;
+  }
   
   if (!decoder->decoder.active) {
     /*
@@ -130,9 +139,12 @@
   gettimeofday(&tv, NULL);
 #endif
 
-  theora_decode_packetin(&(decoder->video_handle), op);
-  theora_decode_YUVout(&(decoder->video_handle), &buffer);
+  if (theora_decode_packetin(&(decoder->video_handle), op) < 0)
+    return -1;
 
+  if (theora_decode_YUVout(&(decoder->video_handle), &buffer) < 0)
+    return -1;
+
 #if TIME_THEORA_DECODE
   gettimeofday(&tv2, NULL);
   musec = tv2.tv_usec - tv.tv_usec;

Modified: liboggplay/trunk/src/tools/oggplay-info.c
===================================================================
--- liboggplay/trunk/src/tools/oggplay-info.c	2008-07-31 16:30:50 UTC (rev 3672)
+++ liboggplay/trunk/src/tools/oggplay-info.c	2008-08-01 09:47:05 UTC (rev 3673)
@@ -123,6 +123,9 @@
 
   printf("Total %d frames.\n", n_frames);
  
+  if (n_frames == 0)
+    return 0;
+
   for (i = 0; i < oggplay_get_num_tracks (player); i++) {
     int j;
     long long mse = 0;



More information about the commits mailing list