Skip to content

Prevent past-EOF access to uni-directional cursors - #8776

Merged
dyemanov merged 1 commit into
FirebirdSQL:masterfrom
Ev3nt:master
Oct 16, 2025
Merged

Prevent past-EOF access to uni-directional cursors#8776
dyemanov merged 1 commit into
FirebirdSQL:masterfrom
Ev3nt:master

Conversation

@Ev3nt

@Ev3nt Ev3nt commented Oct 14, 2025

Copy link
Copy Markdown
Contributor

This code is more secure than the stub in https://github.com/FirebirdSQL/firebird/blob/master/src/dsql/DsqlRequests.cpp#L383

// Fetch from already finished request should not produce error
if (!(request->req_flags & req_active))
{
	if (req_timer)
		req_timer->stop();

	trace.fetch(true, ITracePlugin::RESULT_SUCCESS);
	return false;
}

It can be used as a second level of cursor status checking.

@dyemanov

Copy link
Copy Markdown
Member

A few notes:

  • The original goal is to avoid fetching beyond EOF in cursors, which is currently still possible in the remote protocol prefetch logic. This causes isc_req_sync errors being reported in the trace. It can be additionally fixed inside the protocol code, but this patch is more robust from the possible regressions POV.
  • While this protection it's not strictly required in master (due to the aforementioned check added by Dimitry Sibiryakov recently), it's IMHO better understandable.
  • It unifies EOF handling between uni-directional and scrollable cursors.
  • It can be easily cherry-picked into the prior versions, if desired.

@dyemanov dyemanov changed the title Added verification of finished requests Prevent past-EOF access to uni-directional cursors Oct 16, 2025
@dyemanov
dyemanov merged commit d1cdb70 into FirebirdSQL:master Oct 16, 2025
23 checks passed
@dyemanov dyemanov self-assigned this Oct 16, 2025
@mrotteveel mrotteveel added the rlsnotes60: yes Already added to the Firebird 6.0 release notes. (Do not add this to signal it should be added.) label Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix-version: 6.0 Alpha 1 rlsnotes60: yes Already added to the Firebird 6.0 release notes. (Do not add this to signal it should be added.) type: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants