tree-sitter / tree-sitter/tree-sitter-cpp
`tree_sitter_cpp_external_scanner_deserialize` doesn't bound `length` against the size of the delimiter buffer
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 453
- Forks
- 185
- PR merge metrics
- No merged PRs in 30d
Description
If the function is fed a buffer which exceeds the implicit bound of 64 bytes fed currently, the input can overflow onto the heap. This would be exploitable, if not for the fact that serialize only returns a maximum of MAX_DELIMITER_LENGTH * sizeof(wchar_t) == 64 bytes on Linux and MacOS.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/scanner.c at lines 135-143 and compare tree_sitter_cpp_external_scanner_deserialize with the delimiter buffer size and the serializer’s 64-byte maximum. Verify that oversized input cannot overwrite the delimiter buffer, then run the repository’s tests and confirm normal scanner serialization still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 70/100