Skip to content

Commit c867f34

Browse files
committed
Fixed string_filter (used with internal blob types) that could not report isc_segment.
It fixes #8590 and other similar cases.
1 parent c82c9cf commit c867f34

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/jrd/filters.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,6 @@ static ISC_STATUS string_filter(USHORT action, BlobControl* control)
13091309
*
13101310
**************************************/
13111311
filter_tmp* string;
1312-
USHORT length;
13131312

13141313
switch (action)
13151314
{
@@ -1322,10 +1321,14 @@ static ISC_STATUS string_filter(USHORT action, BlobControl* control)
13221321
return FB_SUCCESS;
13231322

13241323
case isc_blob_filter_get_segment:
1324+
{
13251325
if (!(string = (filter_tmp*) control->ctl_data[1]))
13261326
return isc_segstr_eof;
1327-
length = string->tmp_length - control->ctl_data[2];
1328-
if (length > control->ctl_buffer_length)
1327+
1328+
USHORT length = string->tmp_length - control->ctl_data[2];
1329+
const bool outOfBuffer = (length > control->ctl_buffer_length);
1330+
1331+
if (outOfBuffer)
13291332
length = control->ctl_buffer_length;
13301333
memcpy(control->ctl_buffer, string->tmp_string + (USHORT) control->ctl_data[2], length);
13311334
control->ctl_data[2] += length;
@@ -1334,7 +1337,8 @@ static ISC_STATUS string_filter(USHORT action, BlobControl* control)
13341337
control->ctl_data[2] = 0;
13351338
}
13361339
control->ctl_segment_length = length;
1337-
return (length <= control->ctl_buffer_length) ? FB_SUCCESS : isc_segment;
1340+
return (!outOfBuffer) ? FB_SUCCESS : isc_segment;
1341+
}
13381342

13391343
case isc_blob_filter_put_segment:
13401344
case isc_blob_filter_create:

0 commit comments

Comments
 (0)