You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tomlc99 — Stack Overflow via Uncontrolled Recursion in parse_keyval and parse_array
Summary
Two stack overflow vulnerabilities exist in tomlc99 (latest master) caused by uncontrolled recursion in the TOML parser. A crafted TOML file with deeply nested dotted keys or deeply nested arrays causes a stack overflow crash (segmentation fault), resulting in denial of service. Any application using tomlc99 to parse untrusted TOML input is affected.
Both vulnerabilities have been confirmed via AddressSanitizer and independently reproduced in GDB without sanitizers (using ulimit -s 1024 to set a 1MB stack, typical of threaded applications).
Vulnerability 1: Stack overflow in parse_keyval via deeply nested dotted keys:
The function parse_keyval() at toml.c:1138 calls itself recursively when processing dotted keys (e.g., a.b.c = 1). There is no limit on recursion depth. A TOML input with thousands of dot-separated key segments causes the call stack to grow until it overflows.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7e5beb1 in _int_malloc (av=av@entry=0x7ffff7fb0b80 <main_arena>, bytes=bytes@entry=0x20) at malloc.c:3718
3718 malloc.c: No such file or directory.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.