Skip to content

vadp-dumper: fix out of bounds read#1908

Merged
BareosBot merged 8 commits intobareos:masterfrom
sebsura:dev/ssura/master/fix-vadp-dumper-crash
Aug 9, 2024
Merged

vadp-dumper: fix out of bounds read#1908
BareosBot merged 8 commits intobareos:masterfrom
sebsura:dev/ssura/master/fix-vadp-dumper-crash

Conversation

@sebsura
Copy link
Contributor

@sebsura sebsura commented Jul 31, 2024

Thank you for contributing to the Bareos Project!

We previously did not properly take into account the possibility that there could be unallocated, but changed blocks.
Specifically at the end of a volume. This caused us to read unallocated memory.

This PR adds bounds check to our vector implementation as well as properly handling that case during the processing.

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

Make sure you check/merge the PR using devtools/pr-tool to have some simple automated checks run and a proper changelog record added.

General
  • Is the PR title usable as CHANGELOG entry?
  • Purpose of the PR is understood
  • Commit descriptions are understandable and well formatted
  • Required backport PRs have been created
  • Correct milestone is set
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)

@sebsura sebsura added this to the 24.0.0 milestone Jul 31, 2024
@sebsura sebsura self-assigned this Jul 31, 2024
@sebsura sebsura force-pushed the dev/ssura/master/fix-vadp-dumper-crash branch from 8d7efe4 to ba46534 Compare July 31, 2024 13:23
@sduehr sduehr self-requested a review August 3, 2024 21:23
Copy link
Member

@sduehr sduehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After I understood the intersection algorithm, the requested change seems obvious to me.

@sebsura sebsura force-pushed the dev/ssura/master/fix-vadp-dumper-crash branch from 7fdaad9 to f42dd7a Compare August 5, 2024 04:40
Copy link
Member

@sduehr sduehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't notice it before, subtracting offset from std::min(bend, oend) is missing to get min_length.

@sebsura sebsura force-pushed the dev/ssura/master/fix-vadp-dumper-crash branch 3 times, most recently from 9d01fc4 to b32a30d Compare August 6, 2024 06:10
Copy link
Member

@sduehr sduehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, especially for the extra checks and variable renaming, which make the code a log better readable.

@sebsura sebsura mentioned this pull request Aug 9, 2024
6 tasks
sebsura and others added 8 commits August 9, 2024 09:53
The read_handle should always get closed, not just when we try to
process the cbts.
The names were completely out of sync for things that were basically
the same.  This made it very hard to understand the algorithm as well
as generally being hard to see logic errors.
The early exit means that we do not correctly compute saved_len which
in turn causes us to misrepresent how much data was actually saved
with that api.
@BareosBot BareosBot force-pushed the dev/ssura/master/fix-vadp-dumper-crash branch from 609a4a0 to e50248e Compare August 9, 2024 09:53
@BareosBot BareosBot merged commit 7aa8234 into bareos:master Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants