From bd70193e98e7d572dd5f7d374d5034b3d9c220d7 Mon Sep 17 00:00:00 2001 From: Michael Giacomelli Date: Tue, 30 Jun 2009 22:37:05 +0000 Subject: 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 --- apps/codecs/libtremor/info.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'apps/codecs/libtremor') diff --git a/apps/codecs/libtremor/info.c b/apps/codecs/libtremor/info.c index e96dd88b70..cb3860bbff 100644 --- a/apps/codecs/libtremor/info.c +++ b/apps/codecs/libtremor/info.c @@ -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;icomments;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); -- cgit v1.2.3