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

diff crashes with linematch when line longer than 500 chars #21388

Closed
lewis6991 opened this issue Dec 12, 2022 · 0 comments · Fixed by #21389
Closed

diff crashes with linematch when line longer than 500 chars #21388

lewis6991 opened this issue Dec 12, 2022 · 0 comments · Fixed by #21389
Assignees
Labels
bug-crash issue reporting a crash or segfault diff

Comments

@lewis6991
Copy link
Member

Neovim version (nvim -v)

v0.9.0-dev-499+g49c240d3a

Vim (not Nvim) behaves the same?

NA

Operating system/version

macOS 12.6

Terminal name/version

kitty 0.26.5

$TERM environment variable

xterm-kitty

Installation

build from repo

How to reproduce the issue

describe('regressions', function()
  local screen

  it("doesn't crash with long lines", function()
    clear()
    feed(':set diffopt+=linematch:30<cr>')
    screen = Screen.new(100, 20)
    screen:attach()
    -- line must be greater than MATCH_CHAR_MAX_LEN
    helpers.curbufmeths.set_lines(0, -1, false, { string.rep('a', 500)..'hello' })
    helpers.exec 'vnew'
    helpers.curbufmeths.set_lines(0, -1, false, { string.rep('a', 510)..'world' })
    helpers.exec 'windo diffthis'
  end)
end)

Expected behavior

No crash

Actual behavior

Crash

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x18907ad98 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1890afee0 pthread_kill + 288
2   libsystem_c.dylib             	       0x188fea3cc __abort + 128
3   libsystem_c.dylib             	       0x188fdbd48 __stack_chk_fail + 96
4   nvim                          	       0x104b5715c matching_chars + 712 (linematch.c:128)
5   nvim                          	       0x104b56b70 count_n_matched_chars + 232 (linematch.c:147)
6   nvim                          	       0x104b56884 try_possible_paths + 404 (linematch.c:204)
7   nvim                          	       0x104b569f8 try_possible_paths + 776 (linematch.c:224)
8   nvim                          	       0x104b569f8 try_possible_paths + 776 (linematch.c:224)
9   nvim                          	       0x104b5652c populate_tensor + 320 (linematch.c:279)
10  nvim                          	       0x104b5658c populate_tensor + 416 (linematch.c:286)
11  nvim                          	       0x104b5658c populate_tensor + 416 (linematch.c:286)
12  nvim                          	       0x104b562bc linematch_nbuffers + 468 (linematch.c:368)
13  nvim                          	       0x104a35cd8 run_linematch_algorithm + 348 (diff.c:2082)
14  nvim                          	       0x104a35928 diff_check_with_linestatus + 456 (diff.c:2151)
15  nvim                          	       0x104a33ba8 diff_check + 36 (diff.c:2219)
16  nvim                          	       0x104a32dd4 diff_redraw + 296 (diff.c:693)
17  nvim                          	       0x104a34398 ex_diffupdate + 536 (diff.c:998)
18  nvim                          	       0x104a357a8 diff_check_with_linestatus + 72 (diff.c:2113)
19  nvim                          	       0x104a33ba8 diff_check + 36 (diff.c:2219)
20  nvim                          	       0x104a32dd4 diff_redraw + 296 (diff.c:693)
21  nvim                          	       0x104a33014 diff_buf_add + 152 (diff.c:201)
22  nvim                          	       0x104a32c6c diff_buf_adjust + 328 (diff.c:177)
23  nvim                          	       0x104c07e28 set_bool_option + 2404 (option.c:2126)
24  nvim                          	       0x104c0eb18 set_option_value + 820 (option.c:3090)
25  nvim                          	       0x104c03bf4 set_option_value_give_err + 48 (option.c:3101)
26  nvim                          	       0x104a3527c set_diff_option + 112 (diff.c:1393)
27  nvim                          	       0x104a34fb8 diff_win_options + 752 (diff.c:1462)
28  nvim                          	       0x104b6dd1c main + 2924 (main.c:527)
29  dyld                          	       0x10549d08c start + 520
@lewis6991 lewis6991 added bug issues reporting wrong behavior bug-crash issue reporting a crash or segfault diff and removed bug issues reporting wrong behavior labels Dec 12, 2022
@lewis6991 lewis6991 self-assigned this Dec 12, 2022
lewis6991 added a commit to lewis6991/neovim that referenced this issue Dec 12, 2022
Bump the max line length from 500 -> 800 while we're at it.

Fixes neovim#21388
lewis6991 added a commit to lewis6991/neovim that referenced this issue Dec 12, 2022
Bump the max line length from 500 -> 800 while we're at it.

Fixes neovim#21388
Nero-F pushed a commit to Nero-F/neovim that referenced this issue Dec 16, 2022
yesean pushed a commit to yesean/neovim that referenced this issue Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-crash issue reporting a crash or segfault diff
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant