From 2390d0be30325392bece318c59a706dc57c4506d Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Wed, 12 Oct 2011 09:57:30 +0000 Subject: [PATCH] Frontported fix for CORE-3627: Server crashes with access violation when inserting row into table with unique index --- src/common/cvt.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index cb1560ef73..46dd965a38 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -1741,15 +1741,14 @@ void CVT_conversion_error(const dsc* desc, ErrorFunction err) * A data conversion error occurred. Complain. * **************************************/ - const char* p; - VaryStr<41> s; + Firebird::string message; if (desc->dsc_dtype == dtype_blob) - p = "BLOB"; + message = "BLOB"; else if (desc->dsc_dtype == dtype_array) - p = "ARRAY"; + message = "ARRAY"; else if (desc->dsc_dtype == dtype_boolean) - p = "BOOLEAN"; + message = "BOOLEAN"; else { // CVC: I don't have access here to JRD_get_thread_data())->tdbb_status_vector @@ -1764,9 +1763,11 @@ void CVT_conversion_error(const dsc* desc, ErrorFunction err) try { + const char* p; + VaryStr<41> s; const USHORT length = CVT_make_string(desc, ttype_ascii, &p, &s, sizeof(s) - 1, localError); - const_cast(p)[length] = 0; + message.assign(p, length); } /* catch (status_exception& e) @@ -1784,12 +1785,12 @@ void CVT_conversion_error(const dsc* desc, ErrorFunction err) */ catch (DummyException&) { - p = ""; + message = ""; } } - //// TODO: Need access to transliterate here to convert p to metadata charset. - err(Arg::Gds(isc_convert_error) << p); + //// TODO: Need access to transliterate here to convert message to metadata charset. + err(Arg::Gds(isc_convert_error) << message); }