Skip to content

Fixed string_filter (used with internal blob types) that could not report isc_segment. #8594

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/jrd/filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,6 @@ static ISC_STATUS string_filter(USHORT action, BlobControl* control)
*
**************************************/
filter_tmp* string;
USHORT length;

switch (action)
{
Expand All @@ -1322,10 +1321,14 @@ static ISC_STATUS string_filter(USHORT action, BlobControl* control)
return FB_SUCCESS;

case isc_blob_filter_get_segment:
{
if (!(string = (filter_tmp*) control->ctl_data[1]))
return isc_segstr_eof;
length = string->tmp_length - control->ctl_data[2];
if (length > control->ctl_buffer_length)

USHORT length = string->tmp_length - control->ctl_data[2];
const bool outOfBuffer = (length > control->ctl_buffer_length);

if (outOfBuffer)
length = control->ctl_buffer_length;
memcpy(control->ctl_buffer, string->tmp_string + (USHORT) control->ctl_data[2], length);
control->ctl_data[2] += length;
Expand All @@ -1334,7 +1337,8 @@ static ISC_STATUS string_filter(USHORT action, BlobControl* control)
control->ctl_data[2] = 0;
}
control->ctl_segment_length = length;
return (length <= control->ctl_buffer_length) ? FB_SUCCESS : isc_segment;
return (!outOfBuffer) ? FB_SUCCESS : isc_segment;
}

case isc_blob_filter_put_segment:
case isc_blob_filter_create:
Expand Down
Loading