diff --git a/src/jrd/exe.cpp b/src/jrd/exe.cpp index 231e5c8610..d1537c24de 100644 --- a/src/jrd/exe.cpp +++ b/src/jrd/exe.cpp @@ -819,6 +819,9 @@ void EXE_send(thread_db* tdbb, jrd_req* request, USHORT msg, ULONG length, const CharSet* charSet = INTL_charset_lookup(tdbb, DSC_GET_CHARSET(desc)); + if (!charSet->wellFormed(len, p)) + ERR_post(Arg::Gds(isc_malformed_string)); + const USHORT srcCharLen = charSet->length(len, p, false); const USHORT dstCharLen = descLen / charSet->maxBytesPerChar(); @@ -829,9 +832,6 @@ void EXE_send(thread_db* tdbb, jrd_req* request, USHORT msg, ULONG length, const Arg::Gds(isc_string_truncation) << Arg::Gds(isc_trunc_limits) << Arg::Num(dstCharLen) << Arg::Num(srcCharLen)); } - - if (!charSet->wellFormed(len, p)) - ERR_post(Arg::Gds(isc_malformed_string)); } else if (desc->isBlob()) {