Skip to content

Fix dangling pointers to intToString() temporaries - #55

Merged
teknogeek0 merged 1 commit into
mainfrom
int-to-string-fix
Aug 12, 2026
Merged

Fix dangling pointers to intToString() temporaries#55
teknogeek0 merged 1 commit into
mainfrom
int-to-string-fix

Conversation

@joshmgross

Copy link
Copy Markdown

intToString() returns an IntString by value, and several call sites took a pointer to its embedded strValue buffer directly off the temporary, whose lifetime ends at the end of the statement. On macOS/clang the dead stack memory is reused before the value is read, so pg_restore got --jobs '' and failed; same latent bug in vacuumdb --jobs, a table-exists query param, and sequence setval().

Bind the result to a named local that outlives the pointer.

`intToString()` returns an `IntString` by value, and several call sites
took a pointer to its embedded `strValue` buffer directly off the
temporary, whose lifetime ends at the end of the statement. On
macOS/clang the dead stack memory is reused before the value is read,
so pg_restore got `--jobs ''` and failed; same latent bug in vacuumdb
--jobs, a table-exists query param, and sequence setval().

Bind the result to a named local that outlives the pointer.
@teknogeek0
teknogeek0 merged commit aeb6f9c into main Aug 12, 2026
191 of 192 checks passed
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