Skip to content

fix deallocate alignment in string_impl::destroy - #1181

Open
Ramya-9353 wants to merge 1 commit into
boostorg:developfrom
Ramya-9353:key-string-deallocate-alignment
Open

fix deallocate alignment in string_impl::destroy#1181
Ramya-9353 wants to merge 1 commit into
boostorg:developfrom
Ramya-9353:key-string-deallocate-alignment

Conversation

@Ramya-9353

Copy link
Copy Markdown
Contributor

Split out from #1179 as requested.

Repro: parse a truncated document like {"some key here": with test/checking_resource.hpp as the resource. The abandoned key fails alignment == it->second.second.

Cause: string_impl::destroy frees a key string with the default alignment (max_align), but both key_t constructors allocate it with alignof(char). The default resource ignores the argument, so this only bites upstreams that bucket by alignment.

Fix: pass alignof(char) to match the allocation. Both test cases fail before the fix and pass after.

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://1181.json.prtest2.cppalliance.org/libs/json/doc/html/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-08-05 16:49:29 UTC

@cppalliance-bot

Copy link
Copy Markdown

GCOVR code coverage report https://1181.json.prtest2.cppalliance.org/gcovr/index.html
LCOV code coverage report https://1181.json.prtest2.cppalliance.org/genhtml/index.html
Coverage Diff Report https://1181.json.prtest2.cppalliance.org/diff-report/index.html

Build time: 2026-08-05 17:11:00 UTC

@cppalliance-bot

Copy link
Copy Markdown

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