diff options
author | Mike Buland <eichlan@xagasoft.com> | 2010-10-29 17:05:27 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2010-10-29 17:05:27 +0000 |
commit | 31b0ab27116519ecc441c96166ac36dcd637f68d (patch) | |
tree | fedb8fe5bc44a0dea26d7518f3fb933899f4561e /src | |
parent | 10b68e6b5e7d12c7af51b960191e1be9eb788d2e (diff) | |
download | libbu++-31b0ab27116519ecc441c96166ac36dcd637f68d.tar.gz libbu++-31b0ab27116519ecc441c96166ac36dcd637f68d.tar.bz2 libbu++-31b0ab27116519ecc441c96166ac36dcd637f68d.tar.xz libbu++-31b0ab27116519ecc441c96166ac36dcd637f68d.zip |
Minor change, I discovered where it was getting stuck all this time. If the
underlying stream hits the end before the end of the bzip2 stream then it just
reads forever...that's lame. Now it throws an exception.
Diffstat (limited to '')
-rw-r--r-- | src/bzip2.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bzip2.cpp b/src/bzip2.cpp index b855fd9..a6fef25 100644 --- a/src/bzip2.cpp +++ b/src/bzip2.cpp | |||
@@ -160,6 +160,11 @@ size_t Bu::BZip2::read( void *pData, size_t nBytes ) | |||
160 | if( bzState.avail_in == 0 ) | 160 | if( bzState.avail_in == 0 ) |
161 | { | 161 | { |
162 | nRead = rNext.read( pBuf, nBufSize ); | 162 | nRead = rNext.read( pBuf, nBufSize ); |
163 | if( nRead == 0 && rNext.isEos() ) | ||
164 | { | ||
165 | throw Bu::ExceptionBase("Premature end of underlying " | ||
166 | "stream found reading bzip2 stream."); | ||
167 | } | ||
163 | bzState.next_in = pBuf; | 168 | bzState.next_in = pBuf; |
164 | bzState.avail_in = nRead; | 169 | bzState.avail_in = nRead; |
165 | } | 170 | } |