Skip to content

Add NULL checks on bcb_bdb missing after CORE-6509 (4.0) - #9294

Open
gabrieleciech wants to merge 1 commit into
FirebirdSQL:v4.0-releasefrom
gabrieleciech:fix/cch-null-bdb-4.0
Open

gabrieleciech wants to merge 1 commit into
FirebirdSQL:v4.0-releasefrom
gabrieleciech:fix/cch-null-bdb-4.0

Conversation

@gabrieleciech

Copy link
Copy Markdown
Contributor

Refs #9289 (4.0 part; the 3.0 part is a separate PR). NULL checks only, as suggested there.

CORE-6509 (e17dfa6) initialises the new tail of bcb_rpt to nullptr and checks it in flushAll(), but bcb_count still includes those entries. Other loops up to bcb_count dereference bcb_bdb without a check.

Change

Stop at the first NULL bcb_bdb, as flushAll() already does, in CCH_down_grade_dbb(), CCH_flush_ast(), CCH_shutdown() (the catch path) and get_prec_walk_mark().

CCH_shutdown() was not listed in #9289: it has the same pattern in the cleanup after a failed CCH_flush().

Test

Compiled on Ubuntu 18.04, gcc 7.5 (src/jrd/cch.cpp, Release flags + -Wall). No automated test, as for CORE-6509.

After a failed expand_buffers() bcb_count still includes uninitialised
(NULL) descriptors. CORE-6509 added the check to flushAll() only; add it to
CCH_down_grade_dbb(), CCH_flush_ast(), CCH_shutdown() and
get_prec_walk_mark() as well.

Refs FirebirdSQL#9289
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants