media/libfishsound/bug520500.patch
author Jason Duell <jduell.mcbugs@gmail.com>
Sat, 17 Oct 2009 00:05:27 -0700
changeset 46662 a77022f7680c9486748abe5ddb55cb9af6686cea
parent 33826 6ff04bb6429bf1603851301e2de6760bce138846
permissions -rw-r--r--
Add run_test_in_child() and do_load_child_test_harness() xpcshell functions (bug 521922). r=bent sr=ted Add necko 'unit_ipc' test directory under e10s, plus simple HTTP test.

diff --git a/media/libfishsound/src/libfishsound/fishsound_comments.c b/media/libfishsound/src/libfishsound/fishsound_comments.c
--- a/media/libfishsound/src/libfishsound/fishsound_comments.c
+++ b/media/libfishsound/src/libfishsound/fishsound_comments.c
@@ -480,44 +480,47 @@ fish_sound_comments_decode (FishSound * 
       len=readint(c, 0);
       debug_printf (1, "[%d] len %d\n", i, len);
 
       c+=4;
       if (len > (unsigned long) (end-c)) return -1;
 
       name = c;
       value = fs_index_len (c, '=', len);
+      n = 0;
       if (value) {
 	*value = '\0';
 	value++;
-
 	n = c+len - value;
+	
+      }
+      if (n) {
 	if ((nvalue = fs_strdup_len (value, n)) == NULL)
           return FISH_SOUND_ERR_OUT_OF_MEMORY;
 
 	debug_printf (1, "%s -> %s (length %d)", name, nvalue, n);
 
 	if ((comment = fs_comment_new (name, nvalue)) == NULL) {
 	  fs_free (nvalue);
           return FISH_SOUND_ERR_OUT_OF_MEMORY;
 	}
 
 	if (_fs_comment_add (fsound, comment) == NULL) {
 	  fs_free (nvalue);
           return FISH_SOUND_ERR_OUT_OF_MEMORY;
 	}
 
 	fs_free (nvalue);
-      } else {
+      } else if (len > 0) {
         debug_printf (1, "[%d] %s (no value)", i, name, len);
 
 	if ((nvalue = fs_strdup_len (name, len)) == NULL)
           return FISH_SOUND_ERR_OUT_OF_MEMORY;
 
-	if ((comment = fs_comment_new (nvalue, NULL)) == NULL) {
+	if ((comment = fs_comment_new (nvalue, "")) == NULL) {
 	  fs_free (nvalue);
           return FISH_SOUND_ERR_OUT_OF_MEMORY;
 	}
 
 	if (_fs_comment_add (fsound, comment) == NULL) {
 	  fs_free (nvalue);
           return FISH_SOUND_ERR_OUT_OF_MEMORY;
 	}