8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:03:02 +01:00

Fixed #7467: simple sql crashes firebird: select cast(rdb$db_key as integer) from rdb$database

This commit is contained in:
AlexPeshkoff 2023-02-01 16:33:38 +03:00
parent 24d1d61da0
commit 93cf19eeaa

View File

@ -1789,11 +1789,12 @@ void CVT_move_common(const dsc* from, dsc* to, DecimalStatus decSt, Callbacks* c
ptr += sizeof(USHORT);
Jrd::CharSet* charSet = cb->getToCharset(to->getCharSet());
UCHAR maxBytesPerChar = charSet ? charSet->maxBytesPerChar() : 1;
if (len / charSet->maxBytesPerChar() < from->dsc_length)
if (len / maxBytesPerChar < from->dsc_length)
{
cb->err(Arg::Gds(isc_arith_except) << Arg::Gds(isc_string_truncation) <<
Arg::Gds(isc_trunc_limits) << Arg::Num(len / charSet->maxBytesPerChar()) <<
Arg::Gds(isc_trunc_limits) << Arg::Num(len / maxBytesPerChar) <<
Arg::Num(from->dsc_length));
}
@ -2107,6 +2108,8 @@ void CVT_conversion_error(const dsc* desc, ErrorFunction err)
message = "ARRAY";
else if (desc->dsc_dtype == dtype_boolean)
message = "BOOLEAN";
else if (desc->dsc_dtype == dtype_dbkey)
message = "DBKEY";
else
{
// CVC: I don't have access here to JRD_get_thread_data())->tdbb_status_vector