Skip to content

Commit

Permalink
This should fix bugs
Browse files Browse the repository at this point in the history
#7379: BLOB_APPEND with existing blob accepts malformed string, and
#7380: Aliased blob variable with less restrictions makes text blob accept malformed string through BLOB_APPEND
  • Loading branch information
hvlad committed Nov 11, 2022
1 parent e604506 commit c1580ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/jrd/SysFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2347,7 +2347,10 @@ dsc* evlBlobAppend(thread_db* tdbb, const SysFunction* function, const NestValue
const bool arg0_null = (request->req_flags & req_null) || (argDsc == NULL);

if (!arg0_null && argDsc->isBlob())
{
blob_id = *reinterpret_cast<bid*>(argDsc->dsc_address);
makeBlobAppendBlob(&blobDsc, argDsc, &blob_id);
}

// Try to get blob type from declared var\param
if (!argDsc && (nodeIs<VariableNode>(args[0]) ||
Expand Down Expand Up @@ -2409,13 +2412,14 @@ dsc* evlBlobAppend(thread_db* tdbb, const SysFunction* function, const NestValue

blob = blb::create2(tdbb, transaction, &blob_id, bpb.getCount(), bpb.begin());
blob->blb_flags |= BLB_stream | BLB_close_on_read;
blob->blb_charset = blobDsc.getCharSet();
}

if (!argDsc->isBlob())
{
MoveBuffer temp;
UCHAR* addr = NULL;
SLONG len = MOV_make_string2(tdbb, argDsc, blobDsc.getTextType(), &addr, temp);
SLONG len = MOV_make_string2(tdbb, argDsc, blob->blb_charset, &addr, temp);

if (addr)
blob->BLB_put_data(tdbb, addr, len);
Expand Down

0 comments on commit c1580ff

Please sign in to comment.