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

Fix two memory issues #990

Merged
merged 2 commits into from
Feb 15, 2020
Merged

Fix two memory issues #990

merged 2 commits into from
Feb 15, 2020

Conversation

xaizek
Copy link
Contributor

@xaizek xaizek commented Feb 8, 2020

Occurs on splitting a diff chunk.

memmove() call is supposed to move `old_size - pos` elements that were
already there before invocation of add_line_at() to make space for the
new one.  However, because `view->lines` is increased *before* the move,
it tries to move one more element than it should and ends up writing
outside of allocated chunk of memory.

Fixes jonas#523.
While lines of `context->cell_text` were freed, the array of pointers to
lines wasn't.
@koutcher koutcher merged commit bf0cc12 into jonas:master Feb 15, 2020
@koutcher
Copy link
Collaborator

Good catch. Thanks for sharing.

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