Mercurial > vim
comparison src/testdir/test_crash.vim @ 33863:3b8089d550eb v9.0.2141
patch 9.0.2141: [security]: buffer-overflow in suggest_trie_walk
Commit: https://github.com/vim/vim/commit/0fb375aae608d7306b4baf9c1f906961f32e2abf
Author: Christian Brabandt <cb@256bit.org>
Date: Wed Nov 29 10:23:39 2023 +0100
patch 9.0.2141: [security]: buffer-overflow in suggest_trie_walk
Problem: [security]: buffer-overflow in suggest_trie_walk
Solution: Check n before using it as index into byts array
Basically, n as an index into the byts array, can point to beyond the byts
array. So let's double check, that n is within the expected range after
incrementing it from sp->ts_curi and bail out if it would be invalid.
Reported by @henices, thanks!
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 10 Dec 2023 15:16:03 +0100 |
parents | 242b964d6269 |
children | 6e4c686b6b5b |
comparison
equal
deleted
inserted
replaced
33862:242b964d6269 | 33863:3b8089d550eb |
---|---|
133 let args = printf(cmn_args, vim, file) | 133 let args = printf(cmn_args, vim, file) |
134 call term_sendkeys(buf, args .. | 134 call term_sendkeys(buf, args .. |
135 \ ' && echo "crash 2: [OK]" >> '.. result .. "\<cr>") | 135 \ ' && echo "crash 2: [OK]" >> '.. result .. "\<cr>") |
136 call TermWait(buf, 350) | 136 call TermWait(buf, 350) |
137 | 137 |
138 let file = 'crash/poc_suggest_trie_walk' | |
139 let cmn_args = "%s -u NONE -i NONE -n -e -s -S %s -c ':qa!'" | |
140 let args = printf(cmn_args, vim, file) | |
141 call term_sendkeys(buf, args .. | |
142 \ ' && echo "crash 3: [OK]" >> '.. result .. "\<cr>") | |
143 call TermWait(buf, 150) | |
144 | |
138 " clean up | 145 " clean up |
139 exe buf .. "bw!" | 146 exe buf .. "bw!" |
140 | 147 |
141 exe "sp " .. result | 148 exe "sp " .. result |
142 | 149 |
143 let expected = [ | 150 let expected = [ |
144 \ 'crash 1: [OK]', | 151 \ 'crash 1: [OK]', |
145 \ 'crash 2: [OK]', | 152 \ 'crash 2: [OK]', |
153 \ 'crash 3: [OK]', | |
146 \ ] | 154 \ ] |
147 | 155 |
148 call assert_equal(expected, getline(1, '$')) | 156 call assert_equal(expected, getline(1, '$')) |
149 bw! | 157 bw! |
150 | 158 |