[xiph-commits] r3810 - liboggz/trunk/src/tools/oggz-chop

conrad at svn.annodex.net conrad at svn.annodex.net
Thu Dec 4 13:22:47 PST 2008


Author: conrad
Date: 2008-12-04 13:22:47 -0800 (Thu, 04 Dec 2008)
New Revision: 3810

Modified:
   liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
Log:
oggz-chop: check for invalid track state in read_headers (defensive)


Modified: liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
===================================================================
--- liboggz/trunk/src/tools/oggz-chop/oggz-chop.c	2008-12-04 21:22:39 UTC (rev 3809)
+++ liboggz/trunk/src/tools/oggz-chop/oggz-chop.c	2008-12-04 21:22:47 UTC (rev 3810)
@@ -670,17 +670,21 @@
   fisbone_packet fisbone;
 
   content_type = oggz_stream_get_content(oggz, serialno);
-  if(content_type == OGGZ_CONTENT_SKELETON) {
+  switch (content_type) {
+  case OGGZ_CONTENT_SKELETON:
     if (fisbone_from_ogg_page (og, &fisbone) != -1) {
       if ((ts = oggz_table_lookup (state->tracks, fisbone.serial_no)) != NULL) {
         ts->fisbone.current_header_size = fisbone.current_header_size;
         ts->fisbone.message_header_fields = fisbone.message_header_fields;
       }
     }
-  } else {
+    break;
+  default:
+    ts = oggz_table_lookup (state->tracks, serialno);
+    if (ts == NULL) break;
+
     fwrite_ogg_page (state, og);
 
-    ts = oggz_table_lookup (state->tracks, serialno);
     ts->headers_remaining -= ogg_page_packets (OGG_PAGE_CONST(og));
 
     if (ts->headers_remaining <= 0) {



More information about the commits mailing list