diff --git a/0001-patch-9.1.1551-security-path-traversal-issue-in-zip..patch b/0001-patch-9.1.1551-security-path-traversal-issue-in-zip..patch new file mode 100644 index 0000000000000000000000000000000000000000..b48243680d53187d96d26c294dd0468b4524eafe --- /dev/null +++ b/0001-patch-9.1.1551-security-path-traversal-issue-in-zip..patch @@ -0,0 +1,70 @@ +diff -up vim82/runtime/autoload/zip.vim.CVE-2025-53906 vim82/runtime/autoload/zip.vim +--- vim82/runtime/autoload/zip.vim.CVE-2025-53906 2021-03-22 10:02:41.000000000 +0100 ++++ vim82/runtime/autoload/zip.vim 2025-09-10 19:33:11.491115978 +0200 +@@ -251,6 +251,7 @@ fun! zip#Write(fname) + " call Dfunc("zip#Write(fname<".a:fname.">) zipfile_".winnr()."<".s:zipfile_{winnr()}.">") + let repkeep= &report + set report=10 ++ let need_rename = 0 + + " sanity checks + if !executable(substitute(g:zip_zipcmd,'\s\+.*$','','')) +@@ -261,14 +262,6 @@ fun! zip#Write(fname) + " call Dret("zip#Write") + return + endif +- if !exists("*mkdir") +- redraw! +- echohl Error | echo "***error*** (zip#Write) sorry, mkdir() doesn't work on your system" | echohl None +-" call inputsave()|call input("Press to continue")|call inputrestore() +- let &report= repkeep +-" call Dret("zip#Write") +- return +- endif + + let curdir= getcwd() + let tmpdir= tempname() +@@ -302,6 +295,11 @@ fun! zip#Write(fname) + let zipfile = substitute(a:fname,'^.\{-}zipfile:\(.\{-}\)::[^\\].*$','\1','') + let fname = substitute(a:fname,'^.\{-}zipfile:.\{-}::\([^\\].*\)$','\1','') + endif ++ if fname =~ '^[.]\{1,2}/' ++ call system(g:zip_zipcmd." -d ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0)) ++ let fname = substitute(fname, '^\([.]\{1,2}/\)\+', '', 'g') ++ let need_rename = 1 ++ endif + " call Decho("zipfile<".zipfile.">") + " call Decho("fname <".fname.">") + +@@ -318,7 +316,7 @@ fun! zip#Write(fname) + endif + " call Decho("zipfile<".zipfile."> fname<".fname.">") + +- exe "w! ".fnameescape(fname) ++ exe "w ".fnameescape(fname) + if has("win32unix") && executable("cygpath") + let zipfile = substitute(system("cygpath ".s:Escape(zipfile,0)),'\n','','e') + endif +@@ -348,6 +346,10 @@ fun! zip#Write(fname) + let &binary = binkeep + q! + unlet s:zipfile_{winnr()} ++ elseif need_rename ++ sil exe 'keepalt file '.fnameescape("zipfile://".zipfile.'::'.fname) ++ redraw! ++ echohl Error | echo "***error*** (zip#Browse) Path Traversal Attack detected, dropping relative path" | echohl None + endif + + " cleanup and restore current directory +@@ -383,6 +385,11 @@ fun! zip#Extract() + let &report= repkeep + " call Dret("zip#Extract") + return ++ elseif fname =~ '^[.]\?[.]/' ++ redraw! ++ echohl Error | echo "***error*** (zip#Browse) Path Traversal Attack detected, not extracting!" | echohl None ++ let &report= repkeep ++ return + endif + + " extract the file mentioned under the cursor diff --git a/0001-patch-9.1.1552-security-path-traversal-issue-in-tar..patch b/0001-patch-9.1.1552-security-path-traversal-issue-in-tar..patch new file mode 100644 index 0000000000000000000000000000000000000000..477d688277f8524c8536631e428d66c1324a1fd7 --- /dev/null +++ b/0001-patch-9.1.1552-security-path-traversal-issue-in-tar..patch @@ -0,0 +1,288 @@ +diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim +index 9c518cb..e320b9a 100644 +--- a/runtime/autoload/tar.vim ++++ b/runtime/autoload/tar.vim +@@ -37,10 +37,10 @@ set cpo&vim + " --------------------------------------------------------------------- + " Default Settings: {{{1 + if !exists("g:tar_browseoptions") +- let g:tar_browseoptions= "Ptf" ++ let g:tar_browseoptions= "tf" + endif + if !exists("g:tar_readoptions") +- let g:tar_readoptions= "OPxf" ++ let g:tar_readoptions= "Oxf" + endif + if !exists("g:tar_cmd") + let g:tar_cmd= "tar" +@@ -95,6 +95,9 @@ if !exists("g:tar_shq") + " call Decho("g:tar_shq<".g:tar_shq.">") + endif + ++let g:tar_secure=' -- ' ++let g:tar_leading_pat='^\%([.]\{,2\}/\)\+' ++ + " ---------------- + " Functions: {{{1 + " ---------------- +@@ -195,6 +198,15 @@ fun! tar#Browse(tarfile) + return + endif + ++ " remove tar: Removing leading '/' from member names ++ " Note: the message could be localized ++ if search('^tar: ') > 0 || search(g:tar_leading_pat) > 0 ++ call append(3,'" Note: Path Traversal Attack detected!') ++ let b:leading_slash = 1 ++ " remove the message output ++ sil g/^tar: /d ++ endif ++ + setlocal noma nomod ro + noremap :call TarBrowseSelect() + +@@ -211,12 +223,7 @@ fun! s:TarBrowseSelect() + let fname= getline(".") + " call Decho("fname<".fname.">") + +- if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-' +- redraw! +- echohl WarningMsg | echo '***warning*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"' +-" call Dret('tar#BrowseSelect : rejecting tarfile member<'.fname.'> because of embedded "-"') +- return +- endif ++ let ls= get(b:, 'leading_slash', 0) + + " sanity check + if fname =~ '^"' +@@ -238,7 +245,8 @@ fun! s:TarBrowseSelect() + wincmd _ + endif + let s:tblfile_{winnr()}= curfile +- call tar#Read("tarfile:".tarfile.'::'.fname,1) ++ let b:leading_slash= ls ++ call tar#Read("tarfile:".tarfile.'::'.fname) + filetype detect + set nomod + exe 'com! -buffer -nargs=? -complete=file TarDiff :call tar#Diff(,"'.fnameescape(fname).'")' +@@ -249,8 +257,8 @@ endfun + + " --------------------------------------------------------------------- + " tar#Read: {{{2 +-fun! tar#Read(fname,mode) +-" call Dfunc("tar#Read(fname<".a:fname.">,mode=".a:mode.")") ++fun! tar#Read(fname) ++" call Dfunc("tar#Read(fname<".a:fname.">)") + let repkeep= &report + set report=10 + let tarfile = substitute(a:fname,'tarfile:\(.\{-}\)::.*$','\1','') +@@ -262,6 +270,8 @@ fun! tar#Read(fname,mode) + " call Decho("tarfile<".tarfile.">") + " call Decho("fname<".fname.">") + ++ let curdir= getcwd() ++ let b:curdir= curdir + if fname =~ '\.bz2$' && executable("bzcat") + let decmp= "|bzcat" + let doro = 1 +@@ -282,33 +292,31 @@ fun! tar#Read(fname,mode) + endif + endif + +- if exists("g:tar_secure") +- let tar_secure= " -- " +- else +- let tar_secure= " " +- endif + if tarfile =~# '\.bz2$' +-" call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) +- exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp ++" call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp) ++ exe "sil! r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp + elseif tarfile =~# '\.\(gz\|tgz\)$' +-" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1)) +- exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp ++" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.g:tar_secure.shellescape(fname,1)) ++ exe "sil! r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp + elseif tarfile =~# '\.lrp$' +-" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) +- exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp ++" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp) ++ exe "sil! r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp + elseif tarfile =~# '\.lzma$' +-" call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) +- exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp ++" call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp) ++ exe "sil! r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp + elseif tarfile =~# '\.\(xz\|txz\)$' +-" call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) +- exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp ++" call Decho("3: exe silent r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp) ++ exe "sil! r! xz --decompress --stdout -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_readoptions." - ".g:tar_secure.shellescape(fname,1).decmp + else + if tarfile =~ '^\s*-' + " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. + let tarfile = substitute(tarfile, '-', './-', '') + endif +-" call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions.tar_secure.shellescape(tarfile,1)." ".shellescape(fname,1).decmp) +- exe "silent r! ".g:tar_cmd." -".g:tar_readoptions.shellescape(tarfile,1)." ".tar_secure.shellescape(fname,1).decmp ++" call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions.g:tar_secure.shellescape(tarfile,1)." ".shellescape(fname,1).decmp) ++ exe "silent r! ".g:tar_cmd." -".g:tar_readoptions.shellescape(tarfile,1)." ".g:tar_secure.shellescape(fname,1).decmp ++ endif ++ if get(b:, 'leading_slash', 0) ++ sil g/^tar: /d + endif + + if doro +@@ -317,13 +325,14 @@ fun! tar#Read(fname,mode) + endif + + let b:tarfile= a:fname +- exe "file tarfile::".fnameescape(fname) + + " cleanup + keepj sil! 0d + set nomod + + let &report= repkeep ++ exe "lcd ".fnameescape(curdir) ++ silent exe "file tarfile::".fnameescape(fname) + " call Dret("tar#Read : b:tarfile<".b:tarfile.">") + endfun + +@@ -334,13 +343,6 @@ fun! tar#Write(fname) + let repkeep= &report + set report=10 + +- if !exists("g:tar_secure") && a:fname =~ '^\s*-\|\s\+-' +- redraw! +- echohl WarningMsg | echo '***warning*** (tar#Write) rejecting tarfile member<'.a:fname.'> because of embedded "-"' +-" call Dret('tar#Write : rejecting tarfile member<'.fname.'> because of embedded "-"') +- return +- endif +- + " sanity checks + if !executable(g:tar_cmd) + redraw! +@@ -389,6 +391,13 @@ fun! tar#Write(fname) + let tarfile = substitute(b:tarfile,'tarfile:\(.\{-}\)::.*$','\1','') + let fname = substitute(b:tarfile,'tarfile:.\{-}::\(.*\)$','\1','') + ++ if get(b:, 'leading_slash', 0) ++ redraw! ++ echohl Error | echo "***error*** (tar#Write) sorry, not attempting to update ".tarfile." with ".fname | echohl None ++ let &report= repkeep ++ return ++ endif ++ + " handle compressed archives + if tarfile =~# '\.bz2' + call system("bzip2 -d -- ".shellescape(tarfile,0)) +@@ -442,27 +451,23 @@ fun! tar#Write(fname) + endif + " call Decho("tarfile<".tarfile."> fname<".fname.">") + +- if exists("g:tar_secure") +- let tar_secure= " -- " +- else +- let tar_secure= " " +- endif +- exe "w! ".fnameescape(fname) ++ " don't overwrite a file forcefully ++ exe "w ".fnameescape(fname) + if has("win32unix") && executable("cygpath") + let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e') + endif + + " delete old file from tarfile + " call Decho("system(".g:tar_cmd." --delete -f ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")") +- call system(g:tar_cmd." --delete -f ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) ++ call system(g:tar_cmd." --delete -f ".shellescape(tarfile,0).g:tar_secure.shellescape(fname,0)) + if v:shell_error != 0 + redraw! + echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None + else + + " update tarfile with new file +-" call Decho(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) +- call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) ++" call Decho(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).g:tar_secure.shellescape(fname,0)) ++ call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).g:tar_secure.shellescape(fname,0)) + if v:shell_error != 0 + redraw! + echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None +@@ -511,6 +516,7 @@ fun! tar#Diff(userfname,fname) + if a:userfname != "" + let fname= a:userfname + endif ++ exe "lcd ".fnameescape(b:tmpdir). '/_ZIPVIM_' + if filereadable(fname) + " sets current file (from tarball) for diff'ing + " splits window vertically +diff --git a/runtime/doc/pi_tar.txt b/runtime/doc/pi_tar.txt +index 1b03d31..a6c72cd 100644 +--- a/runtime/doc/pi_tar.txt ++++ b/runtime/doc/pi_tar.txt +@@ -61,7 +61,7 @@ Copyright 2005-2012: *tar-copyright* + the file mentioned in the tarball. If the current directory is not + correct for that path, :TarDiff will fail to find the associated file. + +- If the [filename] is given, that that filename (and path) will be used ++ If the [filename] is given, that filename (and path) will be used + to specify the associated file. + + +@@ -86,18 +86,6 @@ Copyright 2005-2012: *tar-copyright* + *g:tar_readoptions* "OPxf" used to extract a file from a tarball + *g:tar_cmd* "tar" the name of the tar program + *g:tar_nomax* 0 if true, file window will not be maximized +- *g:tar_secure* undef if exists: +- "--"s will be used to prevent unwanted +- option expansion in tar commands. +- Please be sure that your tar command +- accepts "--"; Posix compliant tar +- utilities do accept them. +- if not exists: +- The tar plugin will reject any tar +- files or member files that begin with +- "-" +- Not all tar's support the "--" which is why +- it isn't default. + *g:tar_writeoptions* "uf" used to update/replace a file + + +diff --git a/runtime/doc/tags b/runtime/doc/tags +index 5895c05..2e09b72 100644 +--- a/runtime/doc/tags ++++ b/runtime/doc/tags +@@ -6517,7 +6517,6 @@ g:tar_copycmd pi_tar.txt /*g:tar_copycmd* + g:tar_extractcmd pi_tar.txt /*g:tar_extractcmd* + g:tar_nomax pi_tar.txt /*g:tar_nomax* + g:tar_readoptions pi_tar.txt /*g:tar_readoptions* +-g:tar_secure pi_tar.txt /*g:tar_secure* + g:tar_writeoptions pi_tar.txt /*g:tar_writeoptions* + g:terminal_ansi_colors terminal.txt /*g:terminal_ansi_colors* + g:tex_comment_nospell syntax.txt /*g:tex_comment_nospell* +diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim +index 6d9e6bd..471712f 100644 +--- a/runtime/plugin/tarPlugin.vim ++++ b/runtime/plugin/tarPlugin.vim +@@ -22,14 +22,14 @@ set cpo&vim + " Public Interface: {{{1 + augroup tar + au! +- au BufReadCmd tarfile::* call tar#Read(expand(""), 1) +- au FileReadCmd tarfile::* call tar#Read(expand(""), 0) ++ au BufReadCmd tarfile::* call tar#Read(expand("")) ++ au FileReadCmd tarfile::* call tar#Read(expand("")) + au BufWriteCmd tarfile::* call tar#Write(expand("")) + au FileWriteCmd tarfile::* call tar#Write(expand("")) + + if has("unix") +- au BufReadCmd tarfile::*/* call tar#Read(expand(""), 1) +- au FileReadCmd tarfile::*/* call tar#Read(expand(""), 0) ++ au BufReadCmd tarfile::*/* call tar#Read(expand("")) ++ au FileReadCmd tarfile::*/* call tar#Read(expand("")) + au BufWriteCmd tarfile::*/* call tar#Write(expand("")) + au FileWriteCmd tarfile::*/* call tar#Write(expand("")) + endif diff --git a/0001-vim-anolis-build-with-ruby26.patch b/1000-vim-anolis-build-with-ruby26.patch similarity index 100% rename from 0001-vim-anolis-build-with-ruby26.patch rename to 1000-vim-anolis-build-with-ruby26.patch diff --git a/vim80-sw.patch b/1001-vim80-sw.patch similarity index 100% rename from vim80-sw.patch rename to 1001-vim80-sw.patch diff --git a/vim-8.2-configure-does-not-recognize-gcc-10.0.patch b/1002-vim-8.2-configure-does-not-recognize-gcc-10.0.patch similarity index 100% rename from vim-8.2-configure-does-not-recognize-gcc-10.0.patch rename to 1002-vim-8.2-configure-does-not-recognize-gcc-10.0.patch diff --git a/dist b/dist new file mode 100644 index 0000000000000000000000000000000000000000..1fe92cf0fdf9c2625d878a2ace258f64c1e8ca44 --- /dev/null +++ b/dist @@ -0,0 +1 @@ +an8_10 diff --git a/vim-7.0-hunspell.patch b/vim-7.0-hunspell.patch new file mode 100644 index 0000000000000000000000000000000000000000..ea26bcd2d65629417dd02b145fa76dd240ce85a8 --- /dev/null +++ b/vim-7.0-hunspell.patch @@ -0,0 +1,399 @@ +diff -ru vim70.orig/src/Makefile vim70.hunspell/src/Makefile +--- vim70.orig/src/Makefile 2006-12-15 12:29:41.000000000 +0000 ++++ vim70.hunspell/src/Makefile 2006-12-14 11:11:20.000000000 +0000 +@@ -1287,7 +1287,7 @@ + PFLAGS = $(PROTO_FLAGS) -DPROTO $(LINT_CFLAGS) + + ALL_LIB_DIRS = $(GUI_LIBS_DIR) $(X_LIBS_DIR) +-ALL_LIBS = $(GUI_LIBS1) $(GUI_X_LIBS) $(GUI_LIBS2) $(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LIBS) $(MZSCHEME_LIBS) $(PERL_LIBS) $(PYTHON_LIBS) $(TCL_LIBS) $(RUBY_LIBS) $(PROFILE_LIBS) ++ALL_LIBS = $(GUI_LIBS1) $(GUI_X_LIBS) $(GUI_LIBS2) $(X_PRE_LIBS) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LIBS) $(MZSCHEME_LIBS) $(PERL_LIBS) $(PYTHON_LIBS) $(TCL_LIBS) $(RUBY_LIBS) $(PROFILE_LIBS) -lhunspell-1.1 + + # abbreviations + DEST_BIN = $(DESTDIR)$(BINDIR) +diff -ru vim70.orig/src/spell.c vim70.hunspell/src/spell.c +--- vim70.orig/src/spell.c 2006-12-15 12:29:44.000000000 +0000 ++++ vim70.hunspell/src/spell.c 2006-12-15 12:27:49.000000000 +0000 +@@ -319,6 +319,8 @@ + # include /* for time_t */ + #endif + ++#include "hunspell/hunspell.h" ++ + #define MAXWLEN 250 /* Assume max. word len is this many bytes. + Some places assume a word length fits in a + byte, thus it can't be above 255. */ +@@ -428,6 +430,8 @@ + #define SP_FORMERROR -2 /* format error in spell file */ + #define SP_OTHERERROR -3 /* other error while reading spell file */ + ++#define MAXREGIONS 20 ++ + /* + * Structure used to store words and other info for one language, loaded from + * a .spl file. +@@ -450,6 +454,10 @@ + char_u *sl_name; /* language name "en", "en.rare", "nl", etc. */ + char_u *sl_fname; /* name of .spl file */ + int sl_add; /* TRUE if it's a .add file. */ ++ int sl_ishunspell; /* TRUE if it's an unconverted hunspell aff/dic combination. */ ++ Hunhandle *sl_hunspell; ++ vimconv_T sl_tohunconv; ++ vimconv_T sl_fromhunconv; + + char_u *sl_fbyts; /* case-folded word bytes */ + idx_T *sl_fidxs; /* case-folded word indexes */ +@@ -460,7 +468,7 @@ + + char_u *sl_info; /* infotext string or NULL */ + +- char_u sl_regions[17]; /* table with up to 8 region names plus NUL */ ++ char_u sl_regions[MAXREGIONS * 2 + 1]; /* table with up to 8 region names plus NUL */ + + char_u *sl_midword; /* MIDWORD string or NULL */ + +@@ -997,6 +1005,36 @@ + static char_u *repl_from = NULL; + static char_u *repl_to = NULL; + ++static void ++ensurehunspellinit(lp) ++ slang_T *lp; ++{ ++ if (!lp->sl_hunspell) ++ { ++ char_u *dic = lp->sl_fname; ++ char_u *aff = vim_strnsave(dic, strlen(dic)); ++ ++ vim_strncpy(aff + strlen(aff) - 3, "aff", 3); ++ ++ lp->sl_hunspell = Hunspell_create(aff, dic); ++ ++ vim_free(aff); ++ ++ if (convert_setup(&lp->sl_tohunconv, spell_enc(), ++ Hunspell_get_dic_encoding(lp->sl_hunspell)) == FAIL) ++ { ++ lp->sl_tohunconv.vc_fail = TRUE; ++ } ++ ++ if (convert_setup(&lp->sl_fromhunconv, ++ Hunspell_get_dic_encoding(lp->sl_hunspell), spell_enc()) == FAIL) ++ { ++ lp->sl_fromhunconv.vc_fail = TRUE; ++ } ++ } ++} ++ ++ + /* + * Main spell-checking function. + * "ptr" points to a character that could be the start of a word. +@@ -1101,27 +1139,70 @@ + { + mi.mi_lp = LANGP_ENTRY(wp->w_buffer->b_langp, lpi); + ++ if (mi.mi_lp->lp_slang->sl_ishunspell) ++ { ++ slang_T *lp = mi.mi_lp->lp_slang; ++ char_u *converted = 0; ++ char_u *thisword; ++ char_u *mi_end = mi.mi_end; ++ char_u *mi_final = mi.mi_word + strlen(mi.mi_word); ++ ++ while (1) ++ { ++ ensurehunspellinit(lp); ++ if ((lp->sl_tohunconv.vc_fail == TRUE) || (lp->sl_fromhunconv.vc_fail == TRUE)) ++ break; ++ ++ if (mi_end != mi.mi_word) ++ { ++ thisword = vim_strnsave(mi.mi_word, mi_end - mi.mi_word); ++ converted = string_convert(&lp->sl_tohunconv, thisword, NULL); ++ if (converted) ++ { ++ if (Hunspell_spell(lp->sl_hunspell, converted) != 0) ++ { ++ mi.mi_result = SP_OK; ++ mi.mi_end = mi.mi_cend = mi.mi_word + strlen(thisword); ++ } ++ vim_free(converted); ++ } ++ vim_free(thisword); ++ } ++ ++ if (mi_end == mi_final) ++ break; ++ ++ do ++ { ++ mb_ptr_adv(mi_end); ++ } while (*mi_end != NUL && spell_iswordp(mi_end, wp->w_buffer)); ++ } ++ } ++ + /* If reloading fails the language is still in the list but everything + * has been cleared. */ +- if (mi.mi_lp->lp_slang->sl_fidxs == NULL) ++ if (!mi.mi_lp->lp_slang->sl_ishunspell && mi.mi_lp->lp_slang->sl_fidxs == NULL) + continue; + +- /* Check for a matching word in case-folded words. */ +- find_word(&mi, FIND_FOLDWORD); ++ if (!mi.mi_lp->lp_slang->sl_ishunspell) ++ { ++ /* Check for a matching word in case-folded words. */ ++ find_word(&mi, FIND_FOLDWORD); + +- /* Check for a matching word in keep-case words. */ +- find_word(&mi, FIND_KEEPWORD); ++ /* Check for a matching word in keep-case words. */ ++ find_word(&mi, FIND_KEEPWORD); + +- /* Check for matching prefixes. */ +- find_prefix(&mi, FIND_FOLDWORD); ++ /* Check for matching prefixes. */ ++ find_prefix(&mi, FIND_FOLDWORD); + +- /* For a NOBREAK language, may want to use a word without a following +- * word as a backup. */ +- if (mi.mi_lp->lp_slang->sl_nobreak && mi.mi_result == SP_BAD +- && mi.mi_result2 != SP_BAD) +- { +- mi.mi_result = mi.mi_result2; +- mi.mi_end = mi.mi_end2; ++ /* For a NOBREAK language, may want to use a word without a following ++ * word as a backup. */ ++ if (mi.mi_lp->lp_slang->sl_nobreak && mi.mi_result == SP_BAD ++ && mi.mi_result2 != SP_BAD) ++ { ++ mi.mi_result = mi.mi_result2; ++ mi.mi_end = mi.mi_end2; ++ } + } + + /* Count the word in the first language where it's found to be OK. */ +@@ -2359,6 +2440,80 @@ + + if (r == FAIL) + { ++# define HUNSPELLDICT "/usr/share/myspell/" ++ DIR *dirp = opendir(HUNSPELLDICT); ++ if (dirp != NULL) ++ { ++ slang_T* thislang[MAXREGIONS] = {0}; ++ slang_T *lp = 0; ++ struct dirent *dp; ++ int i = 0; ++ ++ while ((dp = readdir(dirp)) != NULL) ++ { ++ char_u final_name[MAXPATHL]; ++ char_u spf_name[MAXPATHL]; ++ char_u thisregion[3] = {0}; ++ char *resolvedlink = final_name; ++ int j, regionpos; ++ ++ if (strncmp(dp->d_name, lang, strlen(lang)) != 0) ++ continue; ++ ++ if ((strlen(dp->d_name) <= 4) || (dp->d_name[strlen(lang)] != '_')) ++ continue; ++ ++ if (strncmp(".dic", dp->d_name + strlen(dp->d_name) - 4, 4) != 0) ++ continue; ++ ++ vim_strncpy(spf_name, HUNSPELLDICT, strlen(HUNSPELLDICT)); ++ vim_strncpy(spf_name + strlen(HUNSPELLDICT), dp->d_name, strlen(HUNSPELLDICT)); ++ ++ if (realpath(spf_name, resolvedlink) != resolvedlink) ++ continue; ++ ++ thisregion[0] = tolower(dp->d_name[strlen(lang)+1]); ++ thisregion[1] = tolower(dp->d_name[strlen(lang)+1+1]); ++ ++ r = OK; ++ ++ for (j = 0; j < MAXREGIONS; ++j) ++ { ++ if (thislang[j] && (strcmp(thislang[j]->sl_fname, final_name) == 0)) ++ break; ++ } ++ ++ if (j < MAXREGIONS) ++ lp = thislang[j]; ++ else ++ { ++ lp = slang_alloc(lang); ++ lp->sl_ishunspell = TRUE; ++ ++ lp->sl_fname = vim_strsave(resolvedlink); ++ ++ lp->sl_next = first_lang; ++ first_lang = lp; ++ thislang[i] = lp; ++ } ++ ++ regionpos = 0; ++ while (lp->sl_regions[regionpos] != 0) ++regionpos; ++ ++ //silently lose regions which won't fit in ++ if (regionpos == MAXREGIONS * 2) ++ continue; ++ ++ vim_strncpy(lp->sl_regions + regionpos, thisregion, 2); ++ ++ ++i; ++ } ++ closedir(dirp); ++ } ++ } ++ ++ if (r == FAIL) ++ { + smsg((char_u *)_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""), + lang, spell_enc(), lang); + } +@@ -2429,6 +2584,9 @@ + slang_free(lp) + slang_T *lp; + { ++ Hunspell_destroy(lp->sl_hunspell); ++ convert_setup(&lp->sl_tohunconv, NULL, NULL); ++ convert_setup(&lp->sl_fromhunconv, NULL, NULL); + vim_free(lp->sl_name); + vim_free(lp->sl_fname); + slang_clear(lp); +@@ -2974,7 +3132,7 @@ + { + int i; + +- if (len > 16) ++ if (len > MAXREGIONS*2) + return SP_FORMERROR; + for (i = 0; i < len; ++i) + lp->sl_regions[i] = getc(fd); /* */ +@@ -4112,6 +4270,7 @@ + /* loop over comma separated language names. */ + for (splp = buf->b_p_spl; *splp != NUL; ) + { ++ int hunspellregionunsupported; + /* Get one language name. */ + copy_option_part(&splp, lang, MAXWLEN, ","); + +@@ -4182,6 +4341,7 @@ + /* + * Loop over the languages, there can be several files for "lang". + */ ++ hunspellregionunsupported = 0; + for (slang = first_lang; slang != NULL; slang = slang->sl_next) + if (filename ? fullpathcmp(lang, slang->sl_fname, FALSE) == FPC_SAME + : STRICMP(lang, slang->sl_name) == 0) +@@ -4199,6 +4359,11 @@ + /* This addition file is for other regions. */ + region_mask = 0; + } ++ else if (slang->sl_ishunspell) ++ { ++ region_mask = 0; ++ hunspellregionunsupported++; ++ } + else + /* This is probably an error. Give a warning and + * accept the words anyway. */ +@@ -4207,7 +4372,10 @@ + region); + } + else ++ { ++ hunspellregionunsupported--; + region_mask = 1 << c; ++ } + } + + if (region_mask != 0) +@@ -4225,6 +4393,9 @@ + nobreak = TRUE; + } + } ++ ++ if (region && hunspellregionunsupported >= 1) ++ smsg((char_u *) _("Warning: region %s not supported"), region); + } + + /* round 0: load int_wordlist, if possible. +@@ -4832,7 +5003,7 @@ + char_u *si_info; /* info text chars or NULL */ + int si_region_count; /* number of regions supported (1 when there + are no regions) */ +- char_u si_region_name[16]; /* region names; used only if ++ char_u si_region_name[MAXREGIONS*2]; /* region names; used only if + * si_region_count > 1) */ + + garray_T si_rep; /* list of fromto_T entries from REP lines */ +@@ -7093,7 +7264,7 @@ + else + { + line += 8; +- if (STRLEN(line) > 16) ++ if (STRLEN(line) > MAXREGIONS) + smsg((char_u *)_("Too many regions in %s line %d: %s"), + fname, lnum, line); + else +@@ -8973,7 +9144,7 @@ + char_u wfname[MAXPATHL]; + char_u **innames; + int incount; +- afffile_T *(afile[8]); ++ afffile_T *(afile[MAXREGIONS]); + int i; + int len; + struct stat st; +@@ -9040,8 +9211,8 @@ + EMSG(_(e_invarg)); /* need at least output and input names */ + else if (vim_strchr(gettail(wfname), '_') != NULL) + EMSG(_("E751: Output file name must not have region name")); +- else if (incount > 8) +- EMSG(_("E754: Only up to 8 regions supported")); ++ else if (incount > MAXREGIONS) ++ EMSG2(_("E754: Only up to %d regions supported"), MAXREGIONS); + else + { + /* Check for overwriting before doing things that may take a lot of +@@ -11097,6 +11268,36 @@ + { + lp = LANGP_ENTRY(curbuf->b_langp, lpi); + ++ if (lp->lp_slang->sl_ishunspell) ++ { ++ slang_T *slp = lp->lp_slang; ++ char **slst; ++ char_u *converted = 0; ++ ++ ensurehunspellinit(slp); ++ ++ converted = string_convert(&slp->sl_tohunconv, su->su_fbadword, NULL); ++ if (converted) ++ { ++ int suggests; ++ suggests = Hunspell_suggest(slp->sl_hunspell, &slst, converted); ++ if (suggests > 0) ++ { ++ int i; ++ char_u *suggest; ++ for (i = 0; i < suggests; ++i) ++ { ++ suggest = string_convert(&slp->sl_fromhunconv, slst[i], NULL); ++ add_suggestion(su, &su->su_ga, suggest, su->su_badlen, i, 0, FALSE, ++ slp, FALSE); ++ vim_free(suggest); ++ } ++ free(slst); ++ } ++ vim_free(converted); ++ } ++ } ++ + /* If reloading a spell file fails it's still in the list but + * everything has been cleared. */ + if (lp->lp_slang->sl_fbyts == NULL) diff --git a/vim.spec b/vim.spec index 41a720d3bb41d53ef09d01f39c1bf920081ad0ad..737914edcfbd9bf6de619c5da15d7421f5d6fbe4 100644 --- a/vim.spec +++ b/vim.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.2 +%define anolis_release .0.1 %define patchlevel 1763 %if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1} %define WITH_SELINUX 1 @@ -25,7 +25,7 @@ Summary: The VIM editor URL: http://www.vim.org/ Name: vim Version: %{baseversion}.%{patchlevel} -Release: 19%{anolis_release}%{?dist}.5 +Release: 21%{anolis_release}%{?dist} License: Vim and MIT Source0: ftp://ftp.vim.org/pub/vim/unix/vim-%{baseversion}-%{patchlevel}.tar.bz2 Source1: vim.sh @@ -48,10 +48,7 @@ Source16: macros.vim Patch2002: vim-7.0-fixkeys.patch Patch2003: vim-7.4-specsyntax.patch -%if %{withhunspell} Patch2011: vim-7.0-hunspell.patch -BuildRequires: hunspell-devel -%endif Patch3000: vim-7.4-syntax.patch Patch3002: vim-7.4-nowarnings.patch @@ -101,7 +98,7 @@ Patch3032: 0001-patch-8.2.4218-illegal-memory-access-with-bracketed-.patch Patch3033: 0001-patch-8.2.4253-using-freed-memory-when-substitute-wi.patch # CVE-2022-0361 vim: Heap-based Buffer Overflow in GitHub repository Patch3034: 0001-patch-8.2.4215-illegal-memory-access-when-copying-li.patch -# CVE-2022-1154 vim: use after free in utf_ptr2char +# 2073391 - CVE-2022-1154 vim: use after free in utf_ptr2char Patch3035: 0001-patch-8.2.4646-using-buffer-line-after-it-has-been-f.patch # CVE-2022-1621 vim: heap buffer overflow Patch3036: 0001-patch-8.2.4919-can-add-invalid-bytes-with-spellgood.patch @@ -113,13 +110,18 @@ Patch3038: 0001-patch-8.2.4977-memory-access-error-when-substitute-e.patch Patch3039: 0001-patch-8.2.5023-substitute-overwrites-allocated-buffe.patch # CVE-2022-1927 vim: buffer over-read in utf_ptr2char() in mbyte.c Patch3040: 0001-patch-8.2.5037-cursor-position-may-be-invalid-after-.patch +# RHEL-112003 CVE-2025-53905 vim: Vim path traversial +Patch3041: 0001-patch-9.1.1552-security-path-traversal-issue-in-tar..patch +# RHEL-112007 CVE-2025-53906 vim: Vim path traversal +Patch3042: 0001-patch-9.1.1551-security-path-traversal-issue-in-zip..patch + # Add by Anolis # backport patch to fix build error with ruby -Patch10000: 0001-vim-anolis-build-with-ruby26.patch +Patch10000: 1000-vim-anolis-build-with-ruby26.patch # End -Patch10001: vim80-sw.patch -Patch10002: vim-8.2-configure-does-not-recognize-gcc-10.0.patch +Patch10001: 1001-vim80-sw.patch +Patch10002: 1002-vim-8.2-configure-does-not-recognize-gcc-10.0.patch # gcc is no longer in buildroot by default BuildRequires: gcc @@ -144,6 +146,11 @@ BuildRequires: lua-devel Requires: desktop-file-utils BuildRequires: desktop-file-utils >= %{desktop_file_utils_version} %endif + +%if %{withhunspell} +BuildRequires: hunspell-devel +%endif + Epoch: 2 Conflicts: filesystem < 3 @@ -161,7 +168,7 @@ Conflicts: man-pages-pl < 0.24-2 Requires: %{name}-filesystem # it conflicts with older version of vim-minimal during update because of manpage # move -Conflicts: %{name}-minimal < 8.0.1428-4 +Conflicts: %{name}-minimal < 2:8.0.1428-4 %description common VIM (VIsual editor iMproved) is an updated and improved version of the @@ -184,11 +191,11 @@ many different languages. %package minimal Summary: A minimal version of the VIM editor -Provides: vi = %{version}-%{release} +Provides: vi = %{epoch}:%{version}-%{release} Provides: %{_bindir}/vi # it conflicts with older version of vim-common during update because of manpage # move -Conflicts: %{name}-common < 8.0.1428-4 +Conflicts: %{name}-common < 2:8.0.1428-4 %description minimal VIM (VIsual editor iMproved) is an updated and improved version of the @@ -203,7 +210,7 @@ package is installed. %package enhanced Summary: A version of the VIM editor which includes recent enhancements Requires: vim-common = %{epoch}:%{version}-%{release} which -Provides: vim = %{version}-%{release} +Provides: vim = %{epoch}:%{version}-%{release} Provides: %{_bindir}/mergetool Provides: %{_bindir}/vim # suggest python3, python2, lua, ruby and perl packages because of their @@ -234,7 +241,6 @@ need to install the vim-common package. %package filesystem Summary: VIM filesystem layout BuildArch: noarch - %Description filesystem This package provides some directories which are required by other packages that add vim files, p.e. additional syntax files or filetypes. @@ -250,7 +256,7 @@ BuildRequires: libXpm-devel BuildRequires: libICE-devel Requires: vim-common = %{epoch}:%{version}-%{release} libattr >= 2.4 gtk3 -Provides: gvim = %{version}-%{release} +Provides: gvim = %{epoch}:%{version}-%{release} Provides: %{_bindir}/mergetool Provides: %{_bindir}/gvim Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) @@ -337,6 +343,8 @@ perl -pi -e "s,bin/nawk,bin/awk,g" runtime/tools/mve.awk %patch3038 -p1 -b .cve1785 %patch3039 -p1 -b .cve1897 %patch3040 -p1 -b .cve1927 +%patch -P 3041 -p1 -b .CVE-2025-53905 +%patch -P 3042 -p1 -b .CVE-2025-53906 %patch10000 -p1 %patch10001 -p1 @@ -860,29 +868,29 @@ touch %{buildroot}/%{_datadir}/%{name}/vimfiles/doc/tags %{_datadir}/icons/locolor/*/apps/* %changelog -* Mon Nov 20 2023 Weisson - 2:8.0.1763-19.0.2.5 -- add support for gcc having version beyond 10.0. - -* Fri May 12 2023 wxiat - 2:8.0.1763-19.0.1.5 -- add sw patch - -* Mon Aug 08 2022 Mahailiang - 2:8.0.1763-19.0.1.4 +* Fri Oct 10 2025 Mahailiang - 2:8.0.1763-21.0.1 - Rebrand to Anolis(Xiaoxuan Yang) - Fix build issue with ruby(Liwei Ge) +- add sw patch +- add support for gcc having version beyond 10.0. + +* Wed Sep 17 2025 Zdenek Dohnal - 2:8.0.1763-21 +- RHEL-112003 CVE-2025-53905 vim: Vim path traversial +- RHEL-112007 CVE-2025-53906 vim: Vim path traversal -* Tue Jun 14 2022 Zdenek Dohnal - 2:8.0.1763-19.4 +* Tue Jun 14 2022 Zdenek Dohnal - 2:8.0.1763-20 - fix issue reported by covscan -* Mon Jun 13 2022 Zdenek Dohnal - 2:8.0.1763-19.3 +* Mon Jun 13 2022 Zdenek Dohnal - 2:8.0.1763-20 - CVE-2022-1785 vim: Out-of-bounds Write - CVE-2022-1897 vim: out-of-bounds write in vim_regsub_both() in regexp.c - CVE-2022-1927 vim: buffer over-read in utf_ptr2char() in mbyte.c -* Wed May 25 2022 Zdenek Dohnal - 2:8.0.1763-19.2 +* Sat May 14 2022 Zdenek Dohnal - 2:8.0.1763-20 - CVE-2022-1621 vim: heap buffer overflow - CVE-2022-1629 vim: buffer over-read -* Sat Apr 09 2022 Zdenek Dohnal - 2:8.0.1763-19.1 +* Sat Apr 09 2022 Zdenek Dohnal - 2:8.0.1763-20 - CVE-2022-1154 vim: use after free in utf_ptr2char * Tue Feb 08 2022 Zdenek Dohnal - 2:8.0.1763-19