Mercurial > vim
comparison src/spell.c @ 28925:46fa2d54e389 v8.2.4985
patch 8.2.4985: PVS warns for possible array underrun
Commit: https://github.com/vim/vim/commit/875339b22a989d0782097036169e8fb9e2100d7e
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 20 14:10:50 2022 +0100
patch 8.2.4985: PVS warns for possible array underrun
Problem: PVS warns for possible array underrun.
Solution: Add a check for a positive value. (closes https://github.com/vim/vim/issues/10451)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 20 May 2022 15:15:04 +0200 |
parents | ba81f4ed59e2 |
children | fd9006d6ddcf |
comparison
equal
deleted
inserted
replaced
28924:e77054ee4f23 | 28925:46fa2d54e389 |
---|---|
251 | 251 |
252 (void)spell_casefold(wp, ptr, (int)(mi.mi_fend - ptr), mi.mi_fword, | 252 (void)spell_casefold(wp, ptr, (int)(mi.mi_fend - ptr), mi.mi_fword, |
253 MAXWLEN + 1); | 253 MAXWLEN + 1); |
254 mi.mi_fwordlen = (int)STRLEN(mi.mi_fword); | 254 mi.mi_fwordlen = (int)STRLEN(mi.mi_fword); |
255 | 255 |
256 if (camel_case) | 256 if (camel_case && mi.mi_fwordlen > 0) |
257 // Introduce a fake word end space into the folded word. | 257 // Introduce a fake word end space into the folded word. |
258 mi.mi_fword[mi.mi_fwordlen - 1] = ' '; | 258 mi.mi_fword[mi.mi_fwordlen - 1] = ' '; |
259 | 259 |
260 // The word is bad unless we recognize it. | 260 // The word is bad unless we recognize it. |
261 mi.mi_result = SP_BAD; | 261 mi.mi_result = SP_BAD; |