Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Crash when moving cursor in Ex Command Menu #111

Open
GChicha opened this issue Apr 5, 2020 · 1 comment
Open

Crash when moving cursor in Ex Command Menu #111

GChicha opened this issue Apr 5, 2020 · 1 comment

Comments

@GChicha
Copy link

GChicha commented Apr 5, 2020

I made a test to reproduce the error described in onivim/oni2#1554

  describe("CommandLineError", ({test, _}) =>
    test("simple command line", ({expect}) => {
      let _ = reset();
      input(":");
      expect.int(CommandLine.getPosition()).toBe(0);

      input("e");
      expect.int(CommandLine.getPosition()).toBe(1);

      input(" ");
      expect.int(CommandLine.getPosition()).toBe(2);

      input("<Left>");
      expect.int(CommandLine.getPosition()).toBe(1);

      expect.int(Array.length(CommandLine.getCompletions())).toBe(20);
    })
  );

The output got from previous test is the following

SUMMARY: AddressSanitizer: negative-size-param /build/gcc/src/gcc/libsanitizer/asan/asan_interceptors.cc:476 in __interceptor_strncpy

I will try to submit a PR if I manage to solve

@GChicha
Copy link
Author

GChicha commented Apr 5, 2020

I've identified that the error is throwing from libvim, more specifically at

https://github.com/onivim/libvim/blob/da64d8aa23141799cc30f209ef669b708093a0b1/src/ex_getln.c#L5315

For some reason the expand_cmdline function is getting a wrong pattern at xp->xp_pattern, so it can't calculate the right length

https://github.com/onivim/libvim/blob/da64d8aa23141799cc30f209ef669b708093a0b1/src/ex_getln.c#L5485

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant