Compare commits

..

2 Commits

Author SHA1 Message Date
Christian Brabandt
9b7dfa2948 patch 9.2.0075: [security]: Buffer underflow with emacs tag file
Problem:  When parsing a malformed Emacs-style tags file, a 1-byte
          heap-buffer-underflow read occurs if the 0x7f delimiter
          appears at the very beginning of a line. This happens
          because the code attempts to scan backward for a tag
          name from the delimiter without checking if space exists.
          (ehdgks0627, un3xploitable)
Solution: Add a check to ensure the delimiter (p_7f) is not at the
          start of the buffer (lbuf) before attempting to isolate
          the tag name.

GitHub Advisory:
https://github.com/vim/vim/security/advisories/GHSA-xcc8-r6c5-hvwv

Signed-off-by: Christian Brabandt <cb@256bit.org>
2026-02-27 20:46:33 +00:00
Christian Brabandt
f6a7f469a9 patch 9.2.0074: [security]: Crash with overlong emacs tag file
Problem:  Crash with overlong emacs tag file, because of an OOB buffer
          read (ehdgks0627, un3xploitable)
Solution: Check for end of buffer and return early.

Github Advisory:
https://github.com/vim/vim/security/advisories/GHSA-h4mf-vg97-hj8j

Signed-off-by: Christian Brabandt <cb@256bit.org>
2026-02-27 20:38:33 +00:00
3 changed files with 41 additions and 0 deletions

View File

@@ -1901,6 +1901,9 @@ emacs_tags_new_filename(findtags_state_T *st)
for (p = st->ebuf; *p && *p != ','; p++)
;
// invalid
if (*p == NUL)
return;
*p = NUL;
// check for an included tags file.
@@ -2019,6 +2022,9 @@ etag_fail:
}
else // second format: isolate tagname
{
if (p_7f == lbuf)
goto etag_fail;
// find end of tagname
for (p = p_7f - 1; !vim_iswordc(*p); --p)
if (p == lbuf)

View File

@@ -301,4 +301,35 @@ func Test_tag_complete_with_overlong_line()
set tags&
endfunc
" This used to crash Vim
func Test_evil_emacs_tagfile()
CheckFeature emacs_tags
let longline = repeat('a', 515)
call writefile([
\ "\x0c",
\ longline
\ ], 'Xtags', 'D')
set tags=Xtags
call assert_fails(':tag a', 'E426:')
set tags&
endfunc
" This used to crash Vim due to a heap-buffer-underflow
func Test_emacs_tagfile_underflow()
CheckFeature emacs_tags
" The sequence from the crash artifact:
let lines = [
\ "\x0c\xff\xffT\x19\x8a",
\ "\x19\x19\x0dtags\x19\x19\x19\x00\xff\xff\xff",
\ "\x7f3\x0c"
\ ]
call writefile(lines, 'Xtags', 'D')
set tags=Xtags
call assert_fails(':tag a', 'E431:')
set tags&
endfunc
" vim: shiftwidth=2 sts=2 expandtab

View File

@@ -734,6 +734,10 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
75,
/**/
74,
/**/
73,
/**/