From 2b405dd35ba4833edb6b5580a47c6b4bb12988b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemys=C5=82aw=20Czerpak?= Date: Fri, 11 Nov 2022 21:16:00 +0100 Subject: [PATCH] 2022-11-11 21:15 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * contrib/hbcurl/core.c ! use hb_vmPushString() instead of hb_vmPushStringPcode() hb_vmPushStringPcode() is only for static buffer which cannot be freed. Variables passed to PRG debug functions can be stored by PRG code in other variables which lives longer then passed buffer and later cause GPF when curls structure is freed. ! indenting --- ChangeLog.txt | 9 +++++++++ contrib/hbcurl/core.c | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 5c45b28657..9d578a24e6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,15 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2022-11-11 21:15 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * contrib/hbcurl/core.c + ! use hb_vmPushString() instead of hb_vmPushStringPcode() + hb_vmPushStringPcode() is only for static buffer which cannot be freed. + Variables passed to PRG debug functions can be stored by PRG code in + other variables which lives longer then passed buffer and later cause + GPF when curls structure is freed. + ! indenting + 2022-11-11 20:47 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * include/hbapi.h * src/common/hbver.c diff --git a/contrib/hbcurl/core.c b/contrib/hbcurl/core.c index d5f1e51210..b3e66370db 100644 --- a/contrib/hbcurl/core.c +++ b/contrib/hbcurl/core.c @@ -408,9 +408,10 @@ static int hb_curl_progress_callback( void * Cargo, double dltotal, double dlnow return 0; } -static int hb_curl_debug_callback(CURL *handle, curl_infotype type, char *data, size_t size, void *Cargo) +static int hb_curl_debug_callback( CURL * handle, curl_infotype type, char * data, size_t size, void * Cargo ) { HB_SYMBOL_UNUSED( handle ); + if( Cargo ) { PHB_CURL hb_curl = ( PHB_CURL ) Cargo; @@ -419,7 +420,7 @@ static int hb_curl_debug_callback(CURL *handle, curl_infotype type, char *data, hb_vmPushEvalSym(); hb_vmPush( hb_curl->pDebugCallback ); hb_vmPushInteger( type ); - hb_vmPushStringPcode( data, size); + hb_vmPushString( data, size ); hb_vmSend( 2 ); hb_vmRequestRestore();