8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:43:03 +01:00

Fixed CORE-2722 - Storage of malformed blob is allowed when copying from a blob with NONE/OCTETS charset

This commit is contained in:
asfernandes 2009-11-01 16:59:12 +00:00
parent 56c3602bcb
commit 8af12c8aca

View File

@ -1003,16 +1003,20 @@ void BLB_move(thread_db* tdbb, dsc* from_desc, dsc* to_desc, jrd_nod* field)
if (*source == *destination)
return;
UCHAR fromCharSet = from_desc->getCharSet();
UCHAR toCharSet = to_desc->getCharSet();
const bool needFilter =
(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 == isc_blob_text &&
from_desc->dsc_scale != to_desc->dsc_scale &&
to_desc->dsc_scale != CS_NONE && to_desc->dsc_scale != CS_BINARY)));
fromCharSet != toCharSet &&
toCharSet != CS_NONE && toCharSet != CS_BINARY &&
fromCharSet != CS_NONE && fromCharSet != CS_BINARY)));
if (!needFilter && to_desc->isBlob() &&
(from_desc->getCharSet() == CS_NONE || from_desc->getCharSet() == CS_BINARY) &&
(to_desc->getCharSet() != CS_NONE && to_desc->getCharSet() != CS_BINARY))
(fromCharSet == CS_NONE || fromCharSet == CS_BINARY) &&
(toCharSet != CS_NONE && toCharSet != CS_BINARY))
{
AutoBlb blob(tdbb, BLB_open(tdbb, tdbb->getTransaction(), source));
BLB_check_well_formed(tdbb, to_desc, blob.getBlb());