mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:43:04 +01:00
Fixed CORE-2359 - Logical multibyte maximum string length is not respected when assigning numbers
This commit is contained in:
parent
1ac21e7783
commit
c8c61879f7
@ -379,6 +379,7 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
UCHAR* q = (to->dsc_dtype == dtype_varying) ? to->dsc_address + sizeof(USHORT) : to->dsc_address;
|
UCHAR* q = (to->dsc_dtype == dtype_varying) ? to->dsc_address + sizeof(USHORT) : to->dsc_address;
|
||||||
|
const UCHAR* start = q;
|
||||||
|
|
||||||
/* If negative, put in minus sign */
|
/* If negative, put in minus sign */
|
||||||
|
|
||||||
@ -389,10 +390,13 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
|
|||||||
copy number */
|
copy number */
|
||||||
|
|
||||||
if (scale >= 0)
|
if (scale >= 0)
|
||||||
|
{
|
||||||
do {
|
do {
|
||||||
*q++ = *--p;
|
*q++ = *--p;
|
||||||
} while (--l);
|
} while (--l);
|
||||||
else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
l += scale; /* l > 0 (see postassertion: l+scale > 0 above) */
|
l += scale; /* l > 0 (see postassertion: l+scale > 0 above) */
|
||||||
do {
|
do {
|
||||||
*q++ = *--p;
|
*q++ = *--p;
|
||||||
@ -403,12 +407,16 @@ static void integer_to_text(const dsc* from, dsc* to, Callbacks* cb)
|
|||||||
} while (++scale);
|
} while (++scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cb->validateLength(cb->getToCharset(to->getCharSet()), length, start, TEXT_LEN(to), cb->err);
|
||||||
|
|
||||||
/* If padding is required, do it now. */
|
/* If padding is required, do it now. */
|
||||||
|
|
||||||
if (pad_count)
|
if (pad_count)
|
||||||
|
{
|
||||||
do {
|
do {
|
||||||
*q++ = '0';
|
*q++ = '0';
|
||||||
} while (--pad_count);
|
} while (--pad_count);
|
||||||
|
}
|
||||||
|
|
||||||
/* Finish up by padding (if fixed) or computing the actual length
|
/* Finish up by padding (if fixed) or computing the actual length
|
||||||
(varying string) */
|
(varying string) */
|
||||||
|
Loading…
Reference in New Issue
Block a user