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 | 91aca46771ff48fb5a65e10253d4fc721ea74b8d (patch) | |
tree | a3f2a368c85a865f04274181ce71ab5ba2050f27 /src | |
parent | c8fc13e56cb7099f50508fe2392f5da9ec43e747 (diff) | |
download | ogg-91aca46771ff48fb5a65e10253d4fc721ea74b8d.tar.gz |
Fix possible read past the end of the buffer when reading 0 bits.
git-svn-id: http://svn.xiph.org/trunk/ogg@14546 0101bb08-14d6-0310-b084-bc0e0c8e3800
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); |