From d27a422c638fbe0f41eb7e0b7ecf30389f14a44b Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Fri, 10 Jan 2020 13:59:43 +0300 Subject: [PATCH] Backported CORE-6221: Incorrect (throw-based) allocFunc for zlib --- extern/libtommath/makefile.shared | 2 +- src/remote/client/interface.cpp | 1 + src/remote/remote.cpp | 9 ++++++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/extern/libtommath/makefile.shared b/extern/libtommath/makefile.shared index c5793b5b61..4d0cac222d 100644 --- a/extern/libtommath/makefile.shared +++ b/extern/libtommath/makefile.shared @@ -87,7 +87,7 @@ bn_mp_to_signed_bin_n.o bn_mp_to_unsigned_bin_n.o objs: $(OBJECTS) $(LIBNAME): $(OBJECTS) - $(LIBTOOL) --mode=link --tag=CC gcc *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION) + $(LIBTOOL) --mode=link --tag=CC gcc $(LDFLAGS) *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION) install: $(LIBNAME) install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH) diff --git a/src/remote/client/interface.cpp b/src/remote/client/interface.cpp index 0b7d80dd25..42bc523836 100644 --- a/src/remote/client/interface.cpp +++ b/src/remote/client/interface.cpp @@ -6344,6 +6344,7 @@ static void authReceiveResponse(bool havePacket, ClntAuthBlock& cBlock, rem_port break; } + cBlock.resetDataFromPlugin(); cBlock.storeDataForPlugin(d->cstr_length, d->cstr_address); HANDSHAKE_DEBUG(fprintf(stderr, "Cli: receiveResponse: authenticate(%s)\n", cBlock.plugins.name())); if (cBlock.plugins.plugin()->authenticate(&s, &cBlock) == IAuth::AUTH_FAILED) diff --git a/src/remote/remote.cpp b/src/remote/remote.cpp index 0b4aa44cb4..158b9b3aad 100644 --- a/src/remote/remote.cpp +++ b/src/remote/remote.cpp @@ -1369,7 +1369,14 @@ namespace { void* allocFunc(void*, uInt items, uInt size) { - return MemoryPool::globalAlloc(items * size ALLOC_ARGS); + try + { + return MemoryPool::globalAlloc(items * size ALLOC_ARGS); + } + catch (const Firebird::Exception&) + { + return NULL; + } } void freeFunc(void*, void* address)