ref: 2bd6911168b9440b9c4ead117a63220a53009bbb
parent: 8524406f40fabd07d575d8f154f492ab7e5562dd
author: cbagwell <cbagwell>
date: Tue Feb 22 13:07:44 EST 2000
Updating comment code in aiff handler.
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -246,20 +246,12 @@
st_readb(ft, (unsigned char *)&trash);
}
else if (strncmp(buf, "ANNO", 4) == 0) {
- /* Old form of comment chunk */
- st_readdw(ft, &chunksize);
- /* allocate enough memory to hold the comment */
- ft->comment = (char *) malloc((size_t) chunksize);
- if (ft->comment == NULL)
+ rc = textChunk(&(ft->comment), "Annotation:", ft);
+ if (rc)
{
- fail("AIFF: Couldn't allocate ANNO header");
+ /* Fail already called in function */
return(ST_EOF);
}
- if (fread(ft->comment, 1, chunksize, ft->fp) != chunksize)
- {
- fail("AIFF: Unexpected EOF in ANNO header");
- return(ST_EOF);
- }
}
else if (strncmp(buf, "AUTH", 4) == 0) {
/* Author chunk */
@@ -476,6 +468,16 @@
return(ST_EOF);
}
*(*text + chunksize) = '\0';
+ if (chunksize % 2)
+ {
+ /* Read past pad byte */
+ char c;
+ if (fread(&c, 1, 1, ft->fp) != 1)
+ {
+ fail("AIFF: Unexpected EOF in %s header", chunkDescription);
+ return(ST_EOF);
+ }
+ }
if(verbose) {
printf("%-10s \"%s\"\n", chunkDescription, *text);
}