[xiph-commits] r3792 - in liboggz/trunk: include/oggz src/liboggz src/tools src/tools/oggz-chop

conrad at svn.annodex.net conrad at svn.annodex.net
Mon Nov 17 13:35:13 PST 2008


Author: conrad
Date: 2008-11-17 13:35:13 -0800 (Mon, 17 Nov 2008)
New Revision: 3792

Modified:
   liboggz/trunk/include/oggz/oggz_seek.h
   liboggz/trunk/src/liboggz/oggz.c
   liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
   liboggz/trunk/src/tools/oggz-comment.c
Log:
add NULL return checks
for ticket:440, reported by Coverity


Modified: liboggz/trunk/include/oggz/oggz_seek.h
===================================================================
--- liboggz/trunk/include/oggz/oggz_seek.h	2008-11-17 21:34:59 UTC (rev 3791)
+++ liboggz/trunk/include/oggz/oggz_seek.h	2008-11-17 21:35:13 UTC (rev 3792)
@@ -424,6 +424,8 @@
  * \retval 0 Success
  * \retval OGGZ_ERR_BAD_OGGZ \a oggz does not refer to an existing OGGZ
  * \retval OGGZ_ERR_INVALID Operation not suitable for this OGGZ
+ * \retval OGGZ_ERR_BAD_SERIALNO \a serialno does not identify an existing
+ *                               logical bitstream in \a oggz, and is not -1
  */
 int oggz_set_order (OGGZ * oggz, long serialno, OggzOrder order,
 		    void * user_data);

Modified: liboggz/trunk/src/liboggz/oggz.c
===================================================================
--- liboggz/trunk/src/liboggz/oggz.c	2008-11-17 21:34:59 UTC (rev 3791)
+++ liboggz/trunk/src/liboggz/oggz.c	2008-11-17 21:35:13 UTC (rev 3792)
@@ -594,6 +594,8 @@
     oggz->order_user_data = user_data;
   } else {
     stream = oggz_get_stream (oggz, serialno);
+    if (stream == NULL) return OGGZ_ERR_BAD_SERIALNO;
+
     stream->order = order;
     stream->order_user_data = user_data;
   }

Modified: liboggz/trunk/src/tools/oggz-chop/oggz-chop.c
===================================================================
--- liboggz/trunk/src/tools/oggz-chop/oggz-chop.c	2008-11-17 21:34:59 UTC (rev 3791)
+++ liboggz/trunk/src/tools/oggz-chop/oggz-chop.c	2008-11-17 21:35:13 UTC (rev 3792)
@@ -745,6 +745,8 @@
     oggz = oggz_open (state->infilename, OGGZ_READ|OGGZ_AUTO);
   }
 
+  if (oggz == NULL) return -1;
+
   if (state->outfilename == NULL) {
     state->outfile = stdout;
   } else {

Modified: liboggz/trunk/src/tools/oggz-comment.c
===================================================================
--- liboggz/trunk/src/tools/oggz-comment.c	2008-11-17 21:34:59 UTC (rev 3791)
+++ liboggz/trunk/src/tools/oggz-comment.c	2008-11-17 21:35:13 UTC (rev 3792)
@@ -359,14 +359,18 @@
 static void
 store_comment (OCData * ocdata, char * s)
 {
-  char * c, * name, * value;
+  char * c, * name, * value = NULL;
 
-  c = strchr (s, '=');
-  *c = '\0';
+  if (s == NULL) return;
 
   name = s;
-  value = c+1;
 
+  c = strchr (s, '=');
+  if (c != NULL) {
+    *c = '\0';
+    value = c+1;
+  }
+
   oggz_comment_add_byname (ocdata->storer, S_SERIALNO, name, value);
 }
 



More information about the commits mailing list