[xiph-cvs] cvs commit: vorbis-tools/share utf8.c

Michael Smith msmith at xiph.org
Wed Jul 3 07:42:49 PDT 2002



msmith      02/07/03 07:42:49

  Modified:    ogginfo  ogginfo2.c
               share    utf8.c
  Log:
  Fix a leak in ogginfo.
  Workaround for zero-length strings in utf8.c, to avoid crashes.

Revision  Changes    Path
1.6       +2 -4      vorbis-tools/ogginfo/ogginfo2.c

Index: ogginfo2.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogginfo/ogginfo2.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ogginfo2.c	2002/07/01 01:30:32	1.5
+++ ogginfo2.c	2002/07/03 14:42:48	1.6
@@ -306,16 +306,14 @@
                     }
 
                     if(!broken) {
-                        /* A hack around brokenness in the utf8 decoder */
-                        if(strlen(sep+1) == 0)
-                            decoded = sep+1;
-                        else if(utf8_decode(sep+1, &decoded) < 0) {
+                        if(utf8_decode(sep+1, &decoded) < 0) {
                             warn(_("Warning: Failure in utf8 decoder. This "
                                    "should be impossible\n"));
                             continue;
                         }
                         *sep = 0;
                         info("\t%s=%s\n", inf->vc.user_comments[i], decoded);
+                        free(decoded);
                     }
                 }
             }

<p><p>1.6       +6 -0      vorbis-tools/share/utf8.c

Index: utf8.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/share/utf8.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- utf8.c	2002/01/27 05:26:08	1.5
+++ utf8.c	2002/07/03 14:42:48	1.6
@@ -305,6 +305,12 @@
 {
   char *charset;
 
+  if(*from == 0) {
+      *to = malloc(1);
+      **to = 0;
+      return 1;
+  }
+
   if (!current_charset)
     convert_set_charset(0);
   charset = current_charset ? current_charset : "US-ASCII";

<p><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