changeset 767:96b884703411 trunk

[svn] - try to use str_to_utf8() to fill up tuple. we discovered that indecent ogg stream sends non-utf8 metadata.
author yaz
date Thu, 01 Mar 2007 20:09:48 -0800
parents 53f63f43663f
children 1d3f70ac6b31
files ChangeLog src/vorbis/vorbis.c
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 01 18:22:51 2007 -0800
+++ b/ChangeLog	Thu Mar 01 20:09:48 2007 -0800
@@ -1,3 +1,10 @@
+2007-03-02 02:22:51 +0000  Giacomo Lozito <james@develia.org>
+  revision [1630]
+  - extra check with g_utf8_validate to avoid the osd crash when a non-utf8 string survives the str_to_utf8 conversion
+  trunk/src/aosd/aosd_trigger.c |   22 ++++++++++++++--------
+  1 file changed, 14 insertions(+), 8 deletions(-)
+
+
 2007-03-01 14:31:20 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1628]
   - determine whether stream is seekable or not by checking duration. it is safe to use with proxy.
--- a/src/vorbis/vorbis.c	Thu Mar 01 18:22:51 2007 -0800
+++ b/src/vorbis/vorbis.c	Thu Mar 01 20:09:48 2007 -0800
@@ -770,20 +770,20 @@
 
     if ((comment = ov_comment(vorbisfile, -1))) {
         tuple->track_name =
-            g_strdup(vorbis_comment_query(comment, "title", 0));
+            str_to_utf8(vorbis_comment_query(comment, "title", 0));
         tuple->performer =
-            g_strdup(vorbis_comment_query(comment, "artist", 0));
+            str_to_utf8(vorbis_comment_query(comment, "artist", 0));
         tuple->album_name =
-            g_strdup(vorbis_comment_query(comment, "album", 0));
+            str_to_utf8(vorbis_comment_query(comment, "album", 0));
 
         if (vorbis_comment_query(comment, "tracknumber", 0) != NULL)
             tuple->track_number =
                 atoi(vorbis_comment_query(comment, "tracknumber", 0));
 
-        tuple->date = g_strdup(vorbis_comment_query(comment, "date", 0));
-        tuple->genre = g_strdup(vorbis_comment_query(comment, "genre", 0));
+        tuple->date = str_to_utf8(vorbis_comment_query(comment, "date", 0));
+        tuple->genre = str_to_utf8(vorbis_comment_query(comment, "genre", 0));
         tuple->comment =
-            g_strdup(vorbis_comment_query(comment, "comment", 0));
+            str_to_utf8(vorbis_comment_query(comment, "comment", 0));
 
         /* remove any blank tags */
         REMOVE_NONEXISTANT_TAG(tuple->performer);