Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Three actual/potential memory errors #73

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dirkf
Copy link

@dirkf dirkf commented Dec 19, 2020

Fixes three issues in the syntax highlighter that did or could cause corruption or crashes.

Was writing `size` chars but the `hl` array was allocated as `rsize` chars.
With `'\` or `"...\` as the last characters on the line, `HL_STRING` could be written beyond the allocated size of the `hl` array, causing heap corruption and SEGV.
The test for a keyword would try to read the entire length of each keyword from the line position even if the rest of the line was too short to contain that keyword. A PR was already submitted for this but the author closed it before it could be merged.
@a-p-jo
Copy link

a-p-jo commented Feb 28, 2021

This fixes my problem of #76 !
One less segfault !

@akkartik
Copy link

I really appreciate this PR! Many thanks ❤️

akkartik added a commit to akkartik/teliva that referenced this pull request Nov 26, 2021
Many thanks to dirkf for antirez/kilo#73!

However, teliva is still not ASan-clean.
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.

None yet

3 participants