Skip to content

Conversation

lemire
Copy link
Member

@lemire lemire commented May 3, 2023

We potentially reserve string capacity based on the string input size. When the string is empty, there was a potential for us to reserve an undefined amount of memory. This did not happen on current systems but could theoretically happen.

The simple fix is to OR the string size with '1' so that the string size is at least 1, always, and never zero.

@lemire lemire requested a review from anonrig May 3, 2023 18:25
@anonrig anonrig merged commit 12df648 into main May 3, 2023
@anonrig anonrig deleted the dlemire/guard_empty branch May 3, 2023 18:45
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