From: Alexander P. <ale...@us...> - 2007-10-18 11:17:12
|
Build Version : T2.1.0.16917 Firebird 2.1 Beta 2 (writeBuildNum.sh,v 1.17075 2007/10/18 11:16:53 alexpeshkof ) Update of /cvsroot/firebird/firebird2/src/common In directory sc8-pr-cvs17:/tmp/cvs-serv11846 Modified Files: Tag: B2_0_Release fb_exception.cpp Log Message: Backported fix for CORE-1455: Crash in fbclient after unsuccessful user management API call Index: fb_exception.cpp =================================================================== RCS file: /cvsroot/firebird/firebird2/src/common/fb_exception.cpp,v retrieving revision 1.23 retrieving revision 1.23.2.1 diff -b -U3 -r1.23 -r1.23.2.1 --- fb_exception.cpp 6 Apr 2006 08:17:58 -0000 1.23 +++ fb_exception.cpp 18 Oct 2007 11:16:38 -0000 1.23.2.1 @@ -76,6 +76,38 @@ namespace Firebird { +/********************************* StringsBuffer *******************************/ + +void StringsBuffer::makePermanentVector(ISC_STATUS* perm, const ISC_STATUS* trans) +{ + while (true) + { + const ISC_STATUS type = *perm++ = *trans++; + + switch (type) { + case isc_arg_end: + return; + case isc_arg_cstring: + { + const size_t len = *perm++ = *trans++; + const char* temp = reinterpret_cast<char*>(*trans++); + *perm++ = (ISC_STATUS)(IPTR) (alloc(temp, len)); + } + break; + case isc_arg_string: + case isc_arg_interpreted: + { + const char* temp = reinterpret_cast<char*>(*trans++); + *perm++ = (ISC_STATUS)(IPTR) (alloc(temp, strlen(temp))); + } + break; + default: + *perm++ = *trans++; + break; + } + } +} + /********************************* status_exception *******************************/ status_exception::status_exception() throw() : @@ -269,39 +301,16 @@ *sv++ = *ptr++; } } - else { - // Move in status and clone transient strings - while (true) - { - const ISC_STATUS type = *sv++ = *ptr++; - if (type == isc_arg_end) - break; - - switch (type) { - case isc_arg_cstring: - { - const UCHAR len = *sv++ = *ptr++; - char *temp = reinterpret_cast<char*>(*ptr++); - *sv++ = (ISC_STATUS)(IPTR) (sb->alloc(temp, len)); - break; - } - case isc_arg_string: - case isc_arg_interpreted: + else { - char *temp = reinterpret_cast<char*>(*ptr++); - *sv++ = (ISC_STATUS)(IPTR) (sb->alloc(temp, strlen(temp))); - break; - } - default: - *sv++ = *ptr++; - break; - } - } + // Move in status and clone transient strings + sb->makePermanentVector(sv, ptr); } } return status_vector[1]; } - catch (const std::bad_cast&) { + catch (const std::bad_cast&) + { } // Other random C++ exceptions |