diff options
Diffstat (limited to 'apps/codecs/libtremor/info.c')
-rw-r--r-- | apps/codecs/libtremor/info.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/apps/codecs/libtremor/info.c b/apps/codecs/libtremor/info.c index c0bd0ae990..e96dd88b70 100644 --- a/apps/codecs/libtremor/info.c +++ b/apps/codecs/libtremor/info.c | |||
@@ -149,12 +149,21 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){ | |||
149 | vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths)); | 149 | vc->comment_lengths=(int *)_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths)); |
150 | 150 | ||
151 | for(i=0;i<vc->comments;i++){ | 151 | for(i=0;i<vc->comments;i++){ |
152 | int len=oggpack_read(opb,32); | 152 | int len=oggpack_read(opb,32); |
153 | if(len<0)goto err_out; | 153 | if(len<0)goto err_out; |
154 | vc->comment_lengths[i]=len; | 154 | vc->comment_lengths[i]=len; |
155 | vc->user_comments[i]=(char *)_ogg_calloc(len+1,1); | 155 | if(len>10000){ /*truncate long comments rather then seg faulting*/ |
156 | _v_readstring(opb,vc->user_comments[i],len); | 156 | vc->user_comments[i]=(char *)_ogg_calloc(10001,1); |
157 | } | 157 | _v_readstring(opb,vc->user_comments[i],10000); |
158 | /*just to be neat, consumed and discard the rest of the comment*/ | ||
159 | len-=10000; | ||
160 | while(len--) | ||
161 | oggpack_read(opb,8); | ||
162 | }else{ | ||
163 | vc->user_comments[i]=(char *)_ogg_calloc(len+1,1); | ||
164 | _v_readstring(opb,vc->user_comments[i],len); | ||
165 | } | ||
166 | } | ||
158 | if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ | 167 | if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */ |
159 | 168 | ||
160 | return(0); | 169 | return(0); |