diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-19 06:41:59 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-19 06:41:59 +0800 |
commit | bbde37fd64cfb2c65132702374d2b1b3dc5c9390 (patch) | |
tree | 8f0344a88cd22e279525cccf0e0183624d2c05c6 /test/functional/ui/float_spec.lua | |
parent | 46402c16c0c38701469c52fb28d16f2483cc7a72 (diff) | |
download | rneovim-bbde37fd64cfb2c65132702374d2b1b3dc5c9390.tar.gz rneovim-bbde37fd64cfb2c65132702374d2b1b3dc5c9390.tar.bz2 rneovim-bbde37fd64cfb2c65132702374d2b1b3dc5c9390.zip |
vim-patch:9.0.1908: undefined behaviour upper/lower function ptrs (#25238)
Problem: undefined behaviour upper/lower function ptrs
Solution: Fix UBSAN error in regexp and simplify upper/lowercase
modifier code
The implementation of \u / \U / \l / \L modifiers in the substitute
command relies on remembering the state by setting function pointers on
func_all/func_one in the code. The code signature of `fptr_T` is
supposed to return void* (due to C function signatures not being able to
return itself due to type recursion), and the definition of the
functions (e.g. to_Upper) didn't follow this rule, and so the code tries
to cast functions of different signatures, resulting in undefined
behavior error under UBSAN in Clang 17. See vim/vim#12745.
We could just fix `do_Upper`/etc to just return void*, which would fix
the problem. However, these functions actually do not need to return
anything at all. It used to be the case that there was only one pointer
"func" to store the pointer, which is why the function needs to either
return itself or NULL to indicate whether it's a one time or ongoing
modification. However, c2c355df6f094cdb9e599fd395a78c14486ec697
(7.3.873) already made that obsolete by introducing `func_one` and
`func_all` to store one-time and ongoing operations separately, so these
functions don't actually need to return anything anymore because it's
implicit whether it's a one-time or ongoing operation. Simplify the code
to reflect that.
closes: vim/vim#13117
https://github.com/vim/vim/commit/d25021cf036c63d539f845a1ee05b03ea21d61ff
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Diffstat (limited to 'test/functional/ui/float_spec.lua')
0 files changed, 0 insertions, 0 deletions