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

Segfault when searching before starting of file #9

Closed
krpors opened this issue Mar 3, 2017 · 1 comment
Closed

Segfault when searching before starting of file #9

krpors opened this issue Mar 3, 2017 · 1 comment
Labels

Comments

@krpors
Copy link
Owner

krpors commented Mar 3, 2017

To reproduce:

  1. Open file with hx.
  2. Type / to search for a string which does not occur in a file (e.g. akljahlekfahlkdjfh)
  3. Hit N to search backwards
  4. Segmentation fault occurs.

Backtrace:

#0  __memcmp_ssse3 () at ../sysdeps/x86_64/multiarch/memcmp-ssse3.S:1933
#1  0x0000000000402743 in editor_process_search (e=e@entry=0xfc5010, str=<optimized out>, str@entry=0xfc511c "asdfklj", dir=dir@entry=SEARCH_BACKWARD) at editor.c:740
#2  0x0000000000402e92 in editor_process_keypress (e=0xfc5010) at editor.c:923
#3  0x00000000004012de in main (argc=0x2, argv=<optimized out>) at hx.c:177
@krpors krpors added the bug label Mar 3, 2017
krpors added a commit that referenced this issue Mar 10, 2017
This happened since we are working with unsigned integers when
addressing the editor contents. The integer would wrap around to
UINT_MAX, comparing invalid memory addresses in the process. This patch
should fix that.
@krpors
Copy link
Owner Author

krpors commented Mar 13, 2017

Fixed.

@krpors krpors closed this as completed Mar 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant