mirror of
https://github.com/neovim/neovim.git
synced 2026-07-14 21:30:34 +00:00
build: lint "strtol" #40442
Problem: No lint for strtol(). Solution: Add lint, and update existing usages. Callers that previously got a (garbage) large positive value: - `indent.c`: use getdigits() (intmax, no int truncation) with def=1 so overflow/too-large values stay positive and fall through to the existing "too big" check (E475). - `file_search.c`: use getdigits() with def=255 so overflow/too-large values keep the "max expand" (else) branch. The other conversions (api/command.c, eval/window.c, highlight_group.c, tui/tui.c) only diverge on pathological overflow inputs where strtol's result was already garbage and the observable outcome is unchanged.
This commit is contained in:
@@ -43,7 +43,8 @@ describe('clint.lua', function()
|
||||
'test/functional/fixtures/clint_test.c:138: Use xfree(...) instead of free(...). [runtime/memory_fn] [2]',
|
||||
'test/functional/fixtures/clint_test.c:141: Use os_getenv(...) instead of getenv(...). [runtime/os_fn] [2]',
|
||||
'test/functional/fixtures/clint_test.c:142: Use os_setenv(...) instead of setenv(...). [runtime/os_fn] [2]',
|
||||
'Total errors found: 28',
|
||||
'test/functional/fixtures/clint_test.c:143: Use getdigits()/getdigits_int() (or vim_str2nr() for non-decimal bases) instead of strtol, which overflows silently. See src/nvim/charset.c. [runtime/deprecated] [4]',
|
||||
'Total errors found: 29',
|
||||
}
|
||||
t.eq(expected, output_lines)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user