mirror of
https://github.com/neovim/neovim.git
synced 2026-04-01 21:32:10 +00:00
vim-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
f6a7f469a9
Cherry-pick a change from patch 9.0.0767.
Add missing change from patch 9.2.0070.
Co-authored-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
@@ -93,7 +93,7 @@ func Test_global_newline()
|
|||||||
call setline(1, ["foo\<NL>bar"])
|
call setline(1, ["foo\<NL>bar"])
|
||||||
exe "g/foo/s/foo\\\<NL>bar/xyz/"
|
exe "g/foo/s/foo\\\<NL>bar/xyz/"
|
||||||
call assert_equal('xyz', getline(1))
|
call assert_equal('xyz', getline(1))
|
||||||
close!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
" Test :g with ? as delimiter.
|
" Test :g with ? as delimiter.
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ func Test_tag_complete_with_overlong_line()
|
|||||||
inboundGovernor a 2;" kind:⊢ type:forall (muxMode :: MuxMode) socket peerAddr versionNumber m a b. (MonadAsync m, MonadCatch m, MonadEvaluate m, MonadThrow m, MonadThrow (STM m), MonadTime m, MonadTimer m, MonadMask m, Ord peerAddr, HasResponder muxMode ~ True) => Tracer m (RemoteTransitionTrace peerAddr) -> Tracer m (InboundGovernorTrace peerAddr) -> ServerControlChannel muxMode peerAddr ByteString m a b -> DiffTime -> MuxConnectionManager muxMode socket peerAddr versionNumber ByteString m a b -> StrictTVar m InboundGovernorObservableState -> m Void
|
inboundGovernor a 2;" kind:⊢ type:forall (muxMode :: MuxMode) socket peerAddr versionNumber m a b. (MonadAsync m, MonadCatch m, MonadEvaluate m, MonadThrow m, MonadThrow (STM m), MonadTime m, MonadTimer m, MonadMask m, Ord peerAddr, HasResponder muxMode ~ True) => Tracer m (RemoteTransitionTrace peerAddr) -> Tracer m (InboundGovernorTrace peerAddr) -> ServerControlChannel muxMode peerAddr ByteString m a b -> DiffTime -> MuxConnectionManager muxMode socket peerAddr versionNumber ByteString m a b -> StrictTVar m InboundGovernorObservableState -> m Void
|
||||||
inboundGovernorCounters a 3;" kind:⊢ type:InboundGovernorState muxMode peerAddr m a b -> InboundGovernorCounters
|
inboundGovernorCounters a 3;" kind:⊢ type:InboundGovernorState muxMode peerAddr m a b -> InboundGovernorCounters
|
||||||
END
|
END
|
||||||
call writefile(tagslines, 'Xtags')
|
call writefile(tagslines, 'Xtags', 'D')
|
||||||
set tags=Xtags
|
set tags=Xtags
|
||||||
|
|
||||||
" try with binary search
|
" try with binary search
|
||||||
@@ -315,7 +315,21 @@ func Test_tag_complete_with_overlong_line()
|
|||||||
call assert_equal('"tag inboundGSV inboundGovernor inboundGovernorCounters', @:)
|
call assert_equal('"tag inboundGSV inboundGovernor inboundGovernorCounters', @:)
|
||||||
set tagbsearch&
|
set tagbsearch&
|
||||||
|
|
||||||
call delete('Xtags')
|
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&
|
set tags&
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user