Skip to content
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

Validation could read after the end-of-file when handle multifile database [CORE5295] #5573

firebird-automations opened this issue Jun 28, 2016 · 5 comments


Copy link

Submitted by: @hvlad

If multifile database have some (non-last) file with size less than maximum allowed for this file, engine could attempt to read after the end of such file.
Corresponding code is called by validation only. Database is not corrupted.

Test case
a) make backup

b) restore it into multifile database, make first file big enougth to fit whole database
gbak:opened file EMPLOYEE.FBK
gbak:transportable backup -- data in XDR format
gbak: backup file is compressed
gbak:backup version is 10
gbak:created database EMPLOYEE-1.FDB, page_size 8192 bytes
gbak:started transaction
gbak:adding file EMPLOYEE-2.FDB, starting at page 100001
gbak:committing secondary files
gbak:finishing, closing, and going home
gbak:adjusting the ONLINE and FORCED WRITES flags

c) validate restored database
gfix -v EMPLOYEE-1.FDB

I/O error during "ReadFile" operation for file "EMPLOYEE-1.FDB"
-Error while trying to read from file
-Reached the end of file

Commits: d62260d 2b58717 92d0ca8

Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

Copy link
Collaborator Author

Commented by: @hvlad

While v2.5 is not directly affected by this bug (as corresponding validatin code was introduced in v3)
there is one more side effect - file preallocation could be less effective for multifile database.
Therefore i commit fix into v2.5 too.
Single file databases are not affected by this fix.

Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.5.6 [ 10721 ]

Fix Version: 3.0.1 [ 10730 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: No test => Done successfully

Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Closed [ 6 ]

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