Skip to content

Fix integer overflow in yaml_string_extend - #344

Closed
mokoro10 wants to merge 1 commit into
yaml:masterfrom
mokoro10:fix/integer-overflow-in-yaml_string_extend
Closed

Fix integer overflow in yaml_string_extend#344
mokoro10 wants to merge 1 commit into
yaml:masterfrom
mokoro10:fix/integer-overflow-in-yaml_string_extend

Conversation

@mokoro10

@mokoro10 mokoro10 commented Aug 9, 2026

Copy link
Copy Markdown

Adds a missing overflow check in yaml_string_extend mirroring the protection present in yaml_stack_extend.

Without this check, doubling the string size via (*end - *start)*2 could wrap around if the buffer is already large, resulting in a smaller-than-expected allocation and a subsequent heap buffer overflow during memset or string operations.

yaml_stack_extend already has this guard:

if ((char *)*end - (char *)*start >= INT_MAX / 2)
    return 0;

This PR applies the same protection to yaml_string_extend.

@mokoro10 mokoro10 closed this Aug 14, 2026
@mokoro10 mokoro10 reopened this Aug 14, 2026
@mokoro10 mokoro10 closed this by deleting the head repository Aug 14, 2026
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.

1 participant