shithub: sox

Download patch

ref: f39bad1c6bf461374a04f4bf13b2e87a78086a22
parent: 551f1951b833e36a93f841fbafcd02ec368da4dc
author: cbagwell <cbagwell>
date: Mon Jul 12 17:37:24 EDT 1999

Fixed bug in comment field for AIFF files.

--- a/Changelog
+++ b/Changelog
@@ -48,6 +48,8 @@
     add some trash data to the end of the sound file.
   o "avg" effect wouldn't give error message when you tried to average
     x number of channels in to the same number of channels.
+  o Fixed core dump when writting AIFF files with no comments.
+    (Olaf Pueschel)
 
 sox-12.15
 ---------
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -553,14 +553,18 @@
 	/* ANNO chunk -- holds comments text, however this is */
 	/* discouraged by Apple in preference to a COMT comments */
 	/* chunk, which holds a timestamp and marker id */
-	fputs("ANNO", ft->fp);
-	/* Must put an even number of characters out.  True 68k processors OS's
-	 * seem to require this */
-	comment_size = strlen(ft->comment);
-	wlong(ft, (LONG)(((comment_size % 2) == 0) ? comment_size : comment_size + 1)); /* ANNO chunk size, the No of chars */
-	fputs(ft->comment, ft->fp);
-	if (comment_size % 2 == 1)
+	if (ft->comment)
+	{
+	  fputs("ANNO", ft->fp);
+	  /* Must put an even number of characters out.  True 68k processors
+	   * OS's seem to require this 
+	   */
+	  comment_size = strlen(ft->comment);
+	  wlong(ft, (LONG)(((comment_size % 2) == 0) ? comment_size : comment_size + 1)); /* ANNO chunk size, the No of chars */
+	  fputs(ft->comment, ft->fp);
+	  if (comment_size % 2 == 1)
 		fputs(" ", ft->fp);
+	}
 
 	/* COMM chunk -- describes encoding (and #frames) */
 	fputs("COMM", ft->fp);