From 31b0ab27116519ecc441c96166ac36dcd637f68d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 29 Oct 2010 17:05:27 +0000 Subject: 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. --- src/bzip2.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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 ) if( bzState.avail_in == 0 ) { nRead = rNext.read( pBuf, nBufSize ); + if( nRead == 0 && rNext.isEos() ) + { + throw Bu::ExceptionBase("Premature end of underlying " + "stream found reading bzip2 stream."); + } bzState.next_in = pBuf; bzState.avail_in = nRead; } -- cgit v1.2.3