sbuild-util: use resize instead of reserve #6

Open
Arsen wants to merge 1 commit from Arsen/reschroot:main into main
First-time contributor

Using reserved but uninitialized space is invalid, and, additionally,
reserve is not required to allocate memory or change the buffer size at
all.

Hi! A user of schroot on Gentoo Hardened, which enables _GLIBCXX_ASSERTIONS, spotted this misuse of reserve/capacity in sbuild-util.cc, which would prevent schroot starting quite early. This patch converts the reserve call to resize.

The current usage of capacity is not correct, as reserving is not considered a binding operation, and the space it initializes is not considered initialized or otherwise usable.

This patch corrected the issue they were seeing.

Thanks in advance, have a great evening!

Using reserved but uninitialized space is invalid, and, additionally, reserve is not required to allocate memory or change the buffer size at all. Hi! A user of schroot on Gentoo Hardened, which enables `_GLIBCXX_ASSERTIONS`, spotted this misuse of reserve/capacity in `sbuild-util.cc`, which would prevent schroot starting quite early. This patch converts the reserve call to resize. The current usage of capacity is not correct, as reserving is not considered a binding operation, and the space it initializes is not considered initialized or otherwise usable. This patch corrected the issue they were seeing. Thanks in advance, have a great evening!
Contributor

ping

ping
Owner

LGTM, needs rebase though.

LGTM, needs rebase though.
Author
First-time contributor

okay, done (sorry for taking a while, email slipped my inbox, I only noticed when I logged into codeberg)

okay, done (sorry for taking a while, email slipped my inbox, I only noticed when I logged into codeberg)
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u main:Arsen-main
git switch Arsen-main

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff Arsen-main
git switch Arsen-main
git rebase main
git switch main
git merge --ff-only Arsen-main
git switch Arsen-main
git rebase main
git switch main
git merge --no-ff Arsen-main
git switch main
git merge --squash Arsen-main
git switch main
git merge --ff-only Arsen-main
git switch main
git merge Arsen-main
git push origin main
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
shelter/reschroot!6
No description provided.