From 9ea4601ed9ebfcfc5e21a86e743c8886e5ebc4c3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 29 Oct 2011 05:29:00 +0000 Subject: zlib can't really handle empty buffers, so we don't pass empty buffers to it now, even if the function parameters indicate that. --- src/deflate.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/deflate.cpp b/src/deflate.cpp index 2d925a7..704d172 100644 --- a/src/deflate.cpp +++ b/src/deflate.cpp @@ -123,6 +123,8 @@ void Bu::Deflate::zError( int code ) Bu::size Bu::Deflate::read( void *pData, Bu::size nBytes ) { TRACE( pData, nBytes ); + if( nBytes <= 0 ) + return 0; if( !pState->state ) { bReading = true; @@ -191,6 +193,8 @@ Bu::size Bu::Deflate::read( void *pData, Bu::size nBytes ) Bu::size Bu::Deflate::write( const void *pData, Bu::size nBytes ) { TRACE( pData, nBytes ); + if( nBytes <= 0 ) + return 0; if( !pState->state ) { bReading = false; -- cgit v1.2.3