net.http: fix crash on Windows when using Boehm GC (#14351)

master
Isaiah 2022-05-10 07:00:55 -04:00 committed by GitHub
parent 940c78bdfd
commit 9e09b709e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -877,7 +877,7 @@ static SECURITY_STATUS https_make_request(TlsContext *tls_ctx, CHAR *req, CHAR *
// increase buffer size if we need // increase buffer size if we need
int required_length = *length+(int)pDataBuffer->cbBuffer; int required_length = *length+(int)pDataBuffer->cbBuffer;
if( required_length > buff_size ) { if( required_length > buff_size ) {
CHAR *a = realloc(*out, required_length); CHAR *a = VSCHANNEL_REALLOC(*out, required_length);
if( a == NULL ) { if( a == NULL ) {
scRet = SEC_E_INTERNAL_ERROR; scRet = SEC_E_INTERNAL_ERROR;
return scRet; return scRet;

View File

@ -20,6 +20,10 @@
// Define here to be sure // Define here to be sure
#define SP_PROT_TLS1_2_CLIENT 0x00000800 #define SP_PROT_TLS1_2_CLIENT 0x00000800
#if !defined(VSCHANNEL_REALLOC)
#define VSCHANNEL_REALLOC realloc
#endif
typedef struct TlsContext TlsContext; typedef struct TlsContext TlsContext;
TlsContext new_tls_context(); TlsContext new_tls_context();

View File

@ -3,6 +3,10 @@
// that can be found in the LICENSE file. // that can be found in the LICENSE file.
module http module http
$if gcboehm ? {
#define VSCHANNEL_REALLOC GC_REALLOC
}
#flag windows -I @VEXEROOT/thirdparty/vschannel #flag windows -I @VEXEROOT/thirdparty/vschannel
#flag -l ws2_32 -l crypt32 -l secur32 -l user32 #flag -l ws2_32 -l crypt32 -l secur32 -l user32
#include "vschannel.c" #include "vschannel.c"