From 959a53bbdea9507f3d41bf251ec5c416921abc73 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czerpak Date: Sun, 16 Jan 2011 14:49:45 +0000 Subject: [PATCH] 2011-01-16 15:49 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/contrib/hblzf/hblzf.c ! fixed decompress buffer resizing --- harbour/ChangeLog | 4 ++++ harbour/contrib/hblzf/hblzf.c | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 2eefd1315d..9cbadb9688 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,10 @@ The license applies to all entries newer than 2009-04-28. */ +2011-01-16 15:49 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/contrib/hblzf/hblzf.c + ! fixed decompress buffer resizing + 2011-01-16 00:40 UTC+0200 Petr Chornyj (myorg63 at mail.ru) * contrib/hbmxml/hbmxml.c + Added experimental hb_mxmlGetAttrsCount(), hb_mxmlGetAttrs(), diff --git a/harbour/contrib/hblzf/hblzf.c b/harbour/contrib/hblzf/hblzf.c index fc250105d0..b126043fae 100644 --- a/harbour/contrib/hblzf/hblzf.c +++ b/harbour/contrib/hblzf/hblzf.c @@ -190,13 +190,12 @@ HB_FUNC( HB_LZF_DECOMPRESS ) if( buffer && buffer_size ) { - HB_SIZE i = 1; unsigned int uiResult; do { - buffer_size *= i++; - buffer = ( char * ) hb_xrealloc( buffer, buffer_size ); + buffer_size <<= 1; + buffer = ( char * ) hb_xrealloc( buffer, buffer_size + 1 ); uiResult = lzf_decompress( in_data, in_len, buffer, buffer_size ); }