mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 10:43:03 +01:00
Backport fix for CORE-2722 - Storage of malformed blob is allowed when copying from a blob with NONE/OCTETS charset
This commit is contained in:
parent
ba9231d48c
commit
ba8166521c
@ -1003,16 +1003,20 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
|
|||||||
if (*source == *destination)
|
if (*source == *destination)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
UCHAR fromCharSet = from_desc->getCharSet();
|
||||||
|
UCHAR toCharSet = to_desc->getCharSet();
|
||||||
|
|
||||||
const bool needFilter =
|
const bool needFilter =
|
||||||
(from_desc->dsc_sub_type != isc_blob_untyped && to_desc->dsc_sub_type != isc_blob_untyped &&
|
(from_desc->dsc_sub_type != isc_blob_untyped && to_desc->dsc_sub_type != isc_blob_untyped &&
|
||||||
(from_desc->dsc_sub_type != to_desc->dsc_sub_type ||
|
(from_desc->dsc_sub_type != to_desc->dsc_sub_type ||
|
||||||
(from_desc->dsc_sub_type == isc_blob_text &&
|
(from_desc->dsc_sub_type == isc_blob_text &&
|
||||||
from_desc->dsc_scale != to_desc->dsc_scale &&
|
fromCharSet != toCharSet &&
|
||||||
to_desc->dsc_scale != CS_NONE && to_desc->dsc_scale != CS_BINARY)));
|
toCharSet != CS_NONE && toCharSet != CS_BINARY &&
|
||||||
|
fromCharSet != CS_NONE && fromCharSet != CS_BINARY)));
|
||||||
|
|
||||||
if (!needFilter && to_desc->isBlob() &&
|
if (!needFilter && to_desc->isBlob() &&
|
||||||
(from_desc->getCharSet() == CS_NONE || from_desc->getCharSet() == CS_BINARY) &&
|
(fromCharSet == CS_NONE || fromCharSet == CS_BINARY) &&
|
||||||
(to_desc->getCharSet() != CS_NONE && to_desc->getCharSet() != CS_BINARY))
|
(toCharSet != CS_NONE && toCharSet != CS_BINARY))
|
||||||
{
|
{
|
||||||
AutoBlb blob(tdbb, BLB_open(tdbb, tdbb->getTransaction(), source));
|
AutoBlb blob(tdbb, BLB_open(tdbb, tdbb->getTransaction(), source));
|
||||||
BLB_check_well_formed(tdbb, to_desc, blob.getBlb());
|
BLB_check_well_formed(tdbb, to_desc, blob.getBlb());
|
||||||
|
Loading…
Reference in New Issue
Block a user