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

Segmentation violation #18

Closed
jmjatlanta opened this issue Jul 11, 2018 · 1 comment
Closed

Segmentation violation #18

jmjatlanta opened this issue Jul 11, 2018 · 1 comment

Comments

@jmjatlanta
Copy link
Contributor

jmjatlanta commented Jul 11, 2018

This shows up on macOS 10.13 (and maybe others).

editline/src/editline.c

Lines 178 to 182 in 534b389

Screen[ScreenCount] = c;
if (++ScreenCount > ScreenSize) {
ScreenSize += SCREEN_INC;
Screen = realloc(Screen, sizeof(char) * ScreenSize);
}

I believe the realloc should happen before the character is added to the array. Once I made that change, the SIGSEV went away.

Note: The array of items to display had 122 entries, longest 46 (3 columns).

Update: After taking another look, changing the > to a >= will do the trick.

@troglobit
Copy link
Owner

Thank you for reporting, and fixing, this! :)

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

No branches or pull requests

2 participants