diff options
author | Mike Smith <msmith@xiph.org> | 2007-09-13 23:01:16 +0000 |
---|---|---|
committer | Mike Smith <msmith@xiph.org> | 2007-09-13 23:01:16 +0000 |
commit | 64350e068cb8488c1fec8e8c870dce936267e057 (patch) | |
tree | 290a5c1351df6541e7b4c74f096425a63136cf84 /vorbisfile.c | |
parent | e4241cfb73bf3aa544f010eb1dec46255b298e86 (diff) | |
download | tremor-64350e068cb8488c1fec8e8c870dce936267e057.tar.gz |
Calculate number of samples correctly for any number of channels, so we don't
overrun our destination array for > 2 channels.
git-svn-id: https://svn.xiph.org/trunk/Tremor@13794 0101bb08-14d6-0310-b084-bc0e0c8e3800
Diffstat (limited to 'vorbisfile.c')
-rw-r--r-- | vorbisfile.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/vorbisfile.c b/vorbisfile.c index 50b43f2..0c48f1f 100644 --- a/vorbisfile.c +++ b/vorbisfile.c @@ -1564,13 +1564,8 @@ long ov_read(OggVorbis_File *vf,char *buffer,int bytes_req,int *bitstream){ long channels=ov_info(vf,-1)->channels; - if(channels==1){ - if(samples>(bytes_req/2)) - samples=bytes_req/2; - }else{ - if(samples>(bytes_req/4)) - samples=bytes_req/4; - } + if(samples>(bytes_req/(2*channels))) + samples=bytes_req/(2*channels); for(i=0;i<channels;i++) { /* It's faster in this order */ ogg_int32_t *src=pcm[i]; |