diff options
author | Tim Terriberry <tterribe@xiph.org> | 2008-02-29 01:14:05 +0000 |
---|---|---|
committer | Tim Terriberry <tterribe@xiph.org> | 2008-02-29 01:14:05 +0000 |
commit | b345195e557647aa9b4f7bf4bf3a5ce1c4ce0288 (patch) | |
tree | a3f2a368c85a865f04274181ce71ab5ba2050f27 /src | |
parent | aab1325d157d6ef9d81096aeade94b6ad7d9c19e (diff) | |
download | ogg-git-b345195e557647aa9b4f7bf4bf3a5ce1c4ce0288.tar.gz |
Fix possible read past the end of the buffer when reading 0 bits.
svn path=/trunk/ogg/; revision=14546
Diffstat (limited to 'src')
-rw-r--r-- | src/bitwise.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bitwise.c b/src/bitwise.c index 83627e9..380119e 100644 --- a/src/bitwise.c +++ b/src/bitwise.c @@ -355,6 +355,9 @@ long oggpackB_read(oggpack_buffer *b,int bits){ /* not the main path */ ret=-1L; if(b->endbyte*8+bits>b->storage*8)goto overflow; + /* special case to avoid reading b->ptr[0], which might be past the end of + the buffer; also skips some useless accounting */ + else if(!bits)return(0L); } ret=b->ptr[0]<<(24+b->endbit); |