[xiph-cvs] cvs commit: vorbis-tools/ogginfo ogginfo2.c

Michael Smith msmith at xiph.org
Tue Jul 9 07:07:17 PDT 2002



msmith      02/07/09 07:07:17

  Modified:    ogginfo  ogginfo2.c
  Log:
  UTF8 check was wrong for > 1 byte characters, since it miscalculated the
  length

Revision  Changes    Path
1.10      +20 -10    vorbis-tools/ogginfo/ogginfo2.c

Index: ogginfo2.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogginfo/ogginfo2.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- ogginfo2.c	2002/07/07 11:26:11	1.9
+++ ogginfo2.c	2002/07/09 14:07:16	1.10
@@ -241,16 +241,26 @@
                         remaining = inf->vc.comment_lengths[i] - j;
                         if((val[j] & 0x80) == 0)
                             bytes = 1;
-                        else if((val[j] & 0x40) == 0)
-                            bytes = 2;
-                        else if((val[j] & 0x20) == 0)
-                            bytes = 3;
-                        else if((val[j] & 0x10) == 0)
-                            bytes = 4;
-                        else if((val[j] & 0x08) == 0)
-                            bytes = 5;
-                        else if((val[j] & 0x04) == 0)
-                            bytes = 6;
+                        else if((val[j] & 0x40) == 0x40) {
+                            if((val[j] & 0x20) == 0)
+                                bytes = 2;
+                            else if((val[j] & 0x10) == 0)
+                                bytes = 3;
+                            else if((val[j] & 0x08) == 0)
+                                bytes = 4;
+                            else if((val[j] & 0x04) == 0)
+                                bytes = 5;
+                            else if((val[j] & 0x02) == 0)
+                                bytes = 6;
+                            else {
+                                warn(_("Warning: Illegal UTF-8 sequence in "
+                                       "comment %d (stream %d): length "
+                                       "marker wrong\n"),
+                                        i, stream->num);
+                                broken = 1;
+                                break;
+                            }
+                        }
                         else {
                             warn(_("Warning: Illegal UTF-8 sequence in comment "
                                    "%d (stream %d): length marker wrong\n"),

<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