From 409ffccd9c98de4ac1c272cfe5eb8a009dd6ad09 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Fri, 10 Dec 2010 09:00:09 +0000 Subject: [PATCH] 2010-12-10 09:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hblzf/hblzf.c ! Fixed against trying to allocate negative size. (it _will_ result in compile time warning. Don't report it) --- harbour/ChangeLog | 5 +++++ harbour/contrib/hblzf/hblzf.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 5f41f606b1..02df3bab0b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,11 @@ The license applies to all entries newer than 2009-04-28. */ +2010-12-10 09:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hblzf/hblzf.c + ! Fixed against trying to allocate negative size. + (it _will_ result in compile time warning. Don't report it) + 2010-12-10 09:50 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hblzf/hblzf.c * contrib/hblzf/tests/test.prg diff --git a/harbour/contrib/hblzf/hblzf.c b/harbour/contrib/hblzf/hblzf.c index 76f56d1df5..2b0f934755 100644 --- a/harbour/contrib/hblzf/hblzf.c +++ b/harbour/contrib/hblzf/hblzf.c @@ -103,6 +103,9 @@ HB_FUNC( LZF_COMPRESS ) in_len = hb_itemGetCLen( pArg ); out_len = in_len + ( delta ? delta : ( ( HB_SIZE ) ( in_len * 1.04 ) + 1 ) ); + if( out_len < 0 ) + out_len = 0; + out_data = ( char * ) hb_xgrab( out_len + 1 ); uiResult = lzf_compress( in_data, in_len, out_data, out_len );