From 1eb5724325397fb9b0ce08f5da09ef7c2d6bd821 Mon Sep 17 00:00:00 2001 From: eljamm Date: Thu, 17 Oct 2024 08:52:45 +0100 Subject: [PATCH] neovim-unwrapped: fix byte index bounds checking Fix byte index encoding bounds, which were previously only checked against the UTF-8 length, whereas the default is UTF-16, which caused undefined behaviour. See: - https://github.com/neovim/neovim/pull/30747 - https://github.com/nix-community/nixvim/issues/2390 --- pkgs/by-name/ne/neovim-unwrapped/package.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/by-name/ne/neovim-unwrapped/package.nix b/pkgs/by-name/ne/neovim-unwrapped/package.nix index 886444b9442f1..f6348f9368980 100644 --- a/pkgs/by-name/ne/neovim-unwrapped/package.nix +++ b/pkgs/by-name/ne/neovim-unwrapped/package.nix @@ -4,6 +4,7 @@ , libvterm-neovim , tree-sitter , fetchurl +, fetchpatch , buildPackages , treesitter-parsers ? import ./treesitter-parsers.nix { inherit fetchurl; } , CoreServices @@ -82,6 +83,18 @@ in { # necessary so that nix can handle `UpdateRemotePlugins` for the plugins # it installs. See https://github.com/neovim/neovim/issues/9413. ./system_rplugin_manifest.patch + + # FIXME: remove in the next release + # Fix byte index encoding bounds which were previously only checked + # against the UTF-8 length, whereas the default is UTF-16, which caused + # undefined behaviour. + # - https://github.com/neovim/neovim/pull/30747 + # - https://github.com/nix-community/nixvim/issues/2390 + (fetchpatch { + name = "fix-lsp-str_byteindex_enc-bounds-checking-30747.patch"; + url = "https://patch-diff.githubusercontent.com/raw/neovim/neovim/pull/30747.patch"; + hash = "sha256-2oNHUQozXKrHvKxt7R07T9YRIIx8W3gt8cVHLm2gYhg="; + }) ]; dontFixCmake = true;