Skip to content

fix(dpm): Handle case where big record cannot be stored on single page with RHDE header, but with RHD it can be stored - #9244

Open
TreeHunter9 wants to merge 2 commits into
FirebirdSQL:v4.0-releasefrom
TreeHunter9:v4.0-release-dpm-store-big-record-edge-case-fix
Open

TreeHunter9 wants to merge 2 commits into
FirebirdSQL:v4.0-releasefrom
TreeHunter9:v4.0-release-dpm-store-big-record-edge-case-fix

Conversation

@TreeHunter9

Copy link
Copy Markdown
Contributor

The problem happens when record length is between page_size - (sizeof(data_page) + RHDE_SIZE) and page_size - (sizeof(data_page) + RHD_SIZE). It means record has transaction number >32bits and it doesn't fit on the page with RHDE header, so we need to split the record on fragments. The tail fragment happens to be all record size due to usage of RHD header, so in head we write no data at all.

This case currently lead to overflow on size -= length;, which can cause the program to crash due to corrupted while loop.

I also looked at the codebase to find possible problems with record headers and found that gstat was missing some checks for record flags. I fixed that as well.

The main bug presented in v3 and v4.
In v5 and v6 there is no such problem due to differences in store_big_record implementation of taking the tail, but gstat is still affected, so I will create a separate PR for these versions.

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