ref: 5fcf9ef3ee6be2fb7a12ea66fa228c76f193c590
parent: 3bffde39b115cb7e5cb64456f4b9dfe6cd7384e8
author: Gregory Maxwell <greg@xiph.org>
date: Thu Nov 17 17:42:46 EST 2011
Fix opusenc comment writing. Thanks to Justin Ruggles <justin.ruggles@gmail.com> for the report.
--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -796,8 +796,8 @@
void comment_add(char **comments, int* length, char *tag, char *val)
{
char* p=*comments;
- int vendor_length=readint(p, 0);
- int user_comment_list_length=readint(p, 4+vendor_length);
+ int vendor_length=readint(p, 8);
+ int user_comment_list_length=readint(p, 8+4+vendor_length);
int tag_len=(tag?strlen(tag):0);
int val_len=strlen(val);
int len=(*length)+4+tag_len+val_len;
@@ -811,7 +811,7 @@
writeint(p, *length, tag_len+val_len); /* length of comment */
if(tag) memcpy(p+*length+4, tag, tag_len); /* comment */
memcpy(p+*length+4+tag_len, val, val_len); /* comment */
- writeint(p, 4+vendor_length, user_comment_list_length+1);
+ writeint(p, 8+4+vendor_length, user_comment_list_length+1);
*comments=p;
*length=len;