1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-03-27 12:06:44 +01:00
Commit graph

33 commits

Author SHA1 Message Date
Christian Brabandt
49471963fe
patch 9.1.0022: Coverity complains about improper use of negative value
Problem:  Coverity complains about improper use of negative value
Solution: Add a condition to validate that keytyped is larger or equal
          to 0

Apparently patch 9.1.0006 made it more explicit for Coverity, that the
TOLOWER_LOC() macros do not handle negative values properly. However,
that condition has always been there even before that, so add a
condition to verify that keytyped is indeed at least 0

closes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-12 17:48:08 +01:00
Ernie Rael
fda700cb04
patch 9.0.2138: Overflow logic requires long long
Problem:  Overflow logic requires long long
Solution: Define vimlong_T data type to make life easier
          for porters

closes: 

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-30 18:20:00 +01:00
Ernie Rael
2b0882fa65
patch 9.0.2124: INT overflow detection logic can be simplified
Problem:  INT overflow logic can be simplified
Solution: introduce trim_to_int() function

closes: 

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-23 20:33:05 +01:00
Christian Brabandt
3770574e4a
patch 9.0.2122: [security]: prevent overflow in indenting
Problem:  [security]: prevent overflow in indenting
Solution: use long long and remove cast to (int)

The shiftwidth option values are defined as being long. However, when
calculating the actual amount of indent, we cast down to (int), which
may cause the shiftwidth value to become negative and later it may even
cause Vim to try to allocate a huge amount of memory.

We already use long and long long variable types to calculate the indent
(and detect possible overflows), so the cast to (int) seems superfluous
and can be safely removed. So let's just remove the (int) cast and
calculate the indent using longs.

Additionally, the 'shiftwidth' option value is also used when determining
the actual 'cino' options. There it can again cause another overflow, so
make sure it is safe in parse_cino() as well.

fixes: 
closes: 

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-22 22:18:35 +01:00
Bram Moolenaar
c9471b1872 patch 9.0.1529: code style test doesn't check for space after "if"
Problem:    Code style test doesn't check for space after "if".
Solution:   Add a test for space.
2023-05-09 15:00:00 +01:00
Virginia Senioria
99e4ab2a1e patch 9.0.1426: indent wrong after "export namespace" in C++
Problem:    Indent wrong after "export namespace" in C++.
Solution:   Skip over "inline" and "export" in any order. (Virginia Senioria,
            closes , closes )
2023-03-24 19:25:06 +00:00
Bram Moolenaar
ebfec1c531 patch 9.0.1234: the code style has to be checked manually
Problem:    The code style has to be checked manually.
Solution:   Add basic code style checks in a test.  Fix or avoid uncovered
            problems.
2023-01-22 21:14:53 +00:00
Yegappan Lakshmanan
1cfb14aa97 patch 9.0.1166: code is indented more than necessary
Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes )
2023-01-09 19:04:23 +00:00
K.Takata
161b6ac04f patch 9.0.0880: preprocessor indenting is off
Problem:    Preprocessor indenting is off.
Solution:   Adjust preprocessor indentation. (Ken Takata, closes )
2022-11-14 15:31:07 +00:00
zeertzjq
122dea7007 patch 9.0.0095: conditions are always true
Problem:    Conditions are always true.
Solution:   Remove useless conditions. (closes )
2022-07-27 15:48:45 +01:00
Bram Moolenaar
fa4873ccfc patch 9.0.0013: reproducing memory access errors can be difficult
Problem:    Reproducing memory access errors can be difficult.
Solution:   When testing, copy each line to allocated memory, so that valgrind
            can detect accessing memory before and/or after it.  Fix uncovered
            problems.
2022-06-30 22:13:59 +01:00
Bram Moolenaar
8e145b8246 patch 8.2.4993: smart/C/lisp indenting is optional
Problem:    smart/C/lisp indenting is optional, which makes the code more
            complex, while it only reduces the executable size a bit.
Solution:   Graduate FEAT_CINDENT, FEAT_SMARTINDENT and FEAT_LISP.
2022-05-21 20:17:31 +01:00
Bram Moolenaar
60ae0e7149 patch 8.2.4968: reading past end of the line when C-indenting
Problem:    Reading past end of the line when C-indenting.
Solution:   Check for NUL.
2022-05-16 18:06:15 +01:00
Bram Moolenaar
6ed545e797 patch 8.2.4928: various white space and cosmetic mistakes
Problem:    Various white space and cosmetic mistakes.
Solution:   Change spaces to tabs, improve comments.
2022-05-09 20:09:23 +01:00
Bram Moolenaar
249591057b patch 8.2.4911: the mode #defines are not clearly named
Problem:    The mode #defines are not clearly named.
Solution:   Prepend MODE_.  Renumber them to put the mapped modes first.
2022-05-07 20:01:16 +01:00
Bram Moolenaar
a9549c9e8f patch 8.2.4773: build failure without the +eval feature
Problem:    Build failure without the +eval feature.
Solution:   Use other error message.  Avoid warnings.
2022-04-17 14:18:11 +01:00
Bram Moolenaar
cb49a1d934 patch 8.2.4703: memory leak in handling 'cinscopedecls'
Problem:    Memory leak in handling 'cinscopedecls'.
Solution:   Free the memory before returning.
2022-04-07 13:08:00 +01:00
Tom Praschan
3506cf34c1 patch 8.2.4702: C++ scope labels are hard-coded
Problem:    C++ scope labels are hard-coded.
Solution:   Add 'cinscopedecls' to define the labels. (Rom Praschan,
            closes )
2022-04-07 12:39:08 +01:00
Bram Moolenaar
424bcae1fb patch 8.2.4273: the EBCDIC support is outdated
Problem:    The EBCDIC support is outdated.
Solution:   Remove the EBCDIC support.
2022-01-31 14:59:41 +00:00
Bram Moolenaar
ba26367fea patch 8.2.3938: line comment start is also found in a string
Problem:    Line comment start is also found in a string.
Solution:   Skip line comments in a string.
2021-12-29 18:09:13 +00:00
Dominique Pelle
af4a61a85d patch 8.2.3914: various spelling mistakes in comments
Problem:    Various spelling mistakes in comments.
Solution:   Fix the mistakes. (Dominique Pellé, closes )
2021-12-27 17:21:41 +00:00
zeertzjq
f2f0bddf30 patch 8.2.3876: 'cindent' does not recognize inline namespace
Problem:    'cindent' does not recognize inline namespace.
Solution:   Skip over "inline" to find "namespace". (closes )
2021-12-22 20:55:30 +00:00
Bram Moolenaar
6e371ecb27 patch 8.2.3787: no proper formatting of a C line comment after a statement
Problem:    No proper formatting of a C line comment after a statement.
Solution:   Find the start of the line comment, insert the comment leader and
            indent the comment properly.
2021-12-12 14:16:39 +00:00
Bram Moolenaar
2de9b7c7c8 patch 8.2.3625: illegal memory access when C-indenting
Problem:    Illegal memory access when C-indenting.
Solution:   Also set the cursor column.
2021-11-19 19:41:13 +00:00
Bram Moolenaar
78e0fa4cf4 patch 8.2.3482: reading beyond end of line ending in quote and backslash
Problem:    Reading beyond end of line ending in quote and backslash.
Solution:   Check for non-NUL after backslash. (closes )
2021-10-05 21:58:53 +01:00
Yegappan Lakshmanan
4490ec4e83 patch 8.2.3229: Vim9: runtime and compile time type checks are not the same
Problem:    Vim9: runtime and compile time type checks are not the same.
Solution:   Add more runtime type checks for builtin functions. (Yegappan
            Lakshmanan, closes )
2021-07-27 22:00:44 +02:00
K.Takata
eeec254878 patch 8.2.2922: computing array length is done in various ways
Problem:    Computing array length is done in various ways.
Solution:   Use ARRAY_LENGTH everywhere. (Ken Takata, closes )
2021-06-02 13:28:16 +02:00
Bram Moolenaar
8e7d6223f6 patch 8.2.2160: various typos
Problem:    Various typos.
Solution:   Fix spelling mistakes. (closes )
2020-12-18 19:49:56 +01:00
Bram Moolenaar
d881b516da patch 8.2.0864: pragmas are indented all the way to the left
Problem:    Pragmas are indented all the way to the left.
Solution:   Add an option to indent progmas like normal code. (Max Rumpf,
            closes )
2020-05-31 17:49:30 +02:00
Bram Moolenaar
02ad46394e patch 8.2.0112: illegal memory access when using 'cindent'
Problem:    Illegal memory access when using 'cindent'.
Solution:   Check for NUL byte. (Dominique Pelle, closes )
2020-01-12 13:48:18 +01:00
Bram Moolenaar
c667da5185 patch 8.1.2368: using old C style comments
Problem:    Using old C style comments.
Solution:   Use // comments where appropriate.
2019-11-30 20:52:27 +01:00
Bram Moolenaar
32aa10203b patch 8.1.2243: typos in comments
Problem:    Typos in comments.
Solution:   Fix the typos. (Dominique Pelle, closes )  Also adjust
            formatting a bit.
2019-11-02 22:54:41 +01:00
Bram Moolenaar
14c01f8348 patch 8.1.2127: the indent.c file is a bit big
Problem:    The indent.c file is a bit big.
Solution:   Move C-indent code a a new cindent.c file.  Move other
            indent-related code to indent.c. (Yegappan Lakshmanan,
            closes )
2019-10-09 22:53:08 +02:00