forked from len0rd/rockbox
Commit rest of fix in FS#9866. Don't parse Vorbis comments again in libtremor. It wastes memory and we already have the comments in memory. Looking at the spec and code, I think this fix is proper, but if it breaks any files this may need to be revisited.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21581 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a538b89060
commit
bd70193e98
1 changed files with 1 additions and 24 deletions
|
@ -138,34 +138,11 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
|
|||
}
|
||||
|
||||
static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
|
||||
int i;
|
||||
int vendorlen=oggpack_read(opb,32);
|
||||
if(vendorlen<0)goto err_out;
|
||||
vc->vendor=(char *)_ogg_calloc(vendorlen+1,1);
|
||||
_v_readstring(opb,vc->vendor,vendorlen);
|
||||
vc->comments=oggpack_read(opb,32);
|
||||
if(vc->comments<0)goto err_out;
|
||||
vc->user_comments=(char **)_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
|
||||
vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
|
||||
|
||||
for(i=0;i<vc->comments;i++){
|
||||
int len=oggpack_read(opb,32);
|
||||
if(len<0)goto err_out;
|
||||
vc->comment_lengths[i]=len;
|
||||
if(len>10000){ /*truncate long comments rather then seg faulting*/
|
||||
vc->user_comments[i]=(char *)_ogg_calloc(10001,1);
|
||||
_v_readstring(opb,vc->user_comments[i],10000);
|
||||
/*just to be neat, consumed and discard the rest of the comment*/
|
||||
len-=10000;
|
||||
while(len--)
|
||||
oggpack_read(opb,8);
|
||||
}else{
|
||||
vc->user_comments[i]=(char *)_ogg_calloc(len+1,1);
|
||||
_v_readstring(opb,vc->user_comments[i],len);
|
||||
}
|
||||
}
|
||||
if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
|
||||
|
||||
vc->comments=0;
|
||||
return(0);
|
||||
err_out:
|
||||
vorbis_comment_clear(vc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue