Mercurial > vim
comparison src/testdir/test_functions.vim @ 13092:d5647746c267 v8.0.1421
patch 8.0.1421: accessing invalid memory with overlong byte sequence
commit https://github.com/vim/vim/commit/e6640ad44e2186bd3642b972115496d347cd1fdd
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 22 21:06:56 2017 +0100
patch 8.0.1421: accessing invalid memory with overlong byte sequence
Problem: Accessing invalid memory with overlong byte sequence.
Solution: Check for NUL character. (test by Dominique Pelle, closes https://github.com/vim/vim/issues/2485)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 22 Dec 2017 21:15:05 +0100 |
parents | 17720967656c |
children | 4064f342bea4 |
comparison
equal
deleted
inserted
replaced
13091:2c1ce698df03 | 13092:d5647746c267 |
---|---|
266 | 266 |
267 " According to https://twitter.com/jifa/status/625776454479970304 | 267 " According to https://twitter.com/jifa/status/625776454479970304 |
268 " Ⱥ (U+023A) and Ⱦ (U+023E) are the *only* code points to increase | 268 " Ⱥ (U+023A) and Ⱦ (U+023E) are the *only* code points to increase |
269 " in length (2 to 3 bytes) when lowercased. So let's test them. | 269 " in length (2 to 3 bytes) when lowercased. So let's test them. |
270 call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ")) | 270 call assert_equal("ⱥ ⱦ", tolower("Ⱥ Ⱦ")) |
271 | |
272 " This call to tolower with invalid utf8 sequence used to cause access to | |
273 " invalid memory. | |
274 call tolower("\xC0\x80\xC0") | |
275 call tolower("123\xC0\x80\xC0") | |
271 endfunc | 276 endfunc |
272 | 277 |
273 func Test_toupper() | 278 func Test_toupper() |
274 call assert_equal("", toupper("")) | 279 call assert_equal("", toupper("")) |
275 | 280 |
336 call assert_equal("XẊẌ", toupper("XẊẌ")) | 341 call assert_equal("XẊẌ", toupper("XẊẌ")) |
337 call assert_equal("YÝŶŸẎỲỶỸ", toupper("YÝŶŸẎỲỶỸ")) | 342 call assert_equal("YÝŶŸẎỲỶỸ", toupper("YÝŶŸẎỲỶỸ")) |
338 call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ")) | 343 call assert_equal("ZŹŻŽƵẐẔ", toupper("ZŹŻŽƵẐẔ")) |
339 | 344 |
340 call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ")) | 345 call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ")) |
346 | |
347 " This call to toupper with invalid utf8 sequence used to cause access to | |
348 " invalid memory. | |
349 call toupper("\xC0\x80\xC0") | |
350 call toupper("123\xC0\x80\xC0") | |
341 endfunc | 351 endfunc |
342 | 352 |
343 " Tests for the mode() function | 353 " Tests for the mode() function |
344 let current_modes = '' | 354 let current_modes = '' |
345 func Save_mode() | 355 func Save_mode() |