Age | Commit message (Collapse) | Author |
|
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: #13824
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: Overflow logic requires long long
Solution: Define vimlong_T data type to make life easier
for porters
closes: #13598
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: INT overflow logic can be simplified
Solution: introduce trim_to_int() function
closes: #13556
Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
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: #13554
closes: #13555
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: Code style test doesn't check for space after "if".
Solution: Add a test for space.
|
|
Problem: Indent wrong after "export namespace" in C++.
Solution: Skip over "inline" and "export" in any order. (Virginia Senioria,
closes #12134, closes #12133)
|
|
Problem: The code style has to be checked manually.
Solution: Add basic code style checks in a test. Fix or avoid uncovered
problems.
|
|
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11792)
|
|
Problem: Preprocessor indenting is off.
Solution: Adjust preprocessor indentation. (Ken Takata, closes #11546)
|
|
Problem: Conditions are always true.
Solution: Remove useless conditions. (closes #10802)
|
|
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.
|
|
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.
|
|
Problem: Reading past end of the line when C-indenting.
Solution: Check for NUL.
|
|
Problem: Various white space and cosmetic mistakes.
Solution: Change spaces to tabs, improve comments.
|
|
Problem: The mode #defines are not clearly named.
Solution: Prepend MODE_. Renumber them to put the mapped modes first.
|
|
Problem: Build failure without the +eval feature.
Solution: Use other error message. Avoid warnings.
|
|
Problem: Memory leak in handling 'cinscopedecls'.
Solution: Free the memory before returning.
|
|
Problem: C++ scope labels are hard-coded.
Solution: Add 'cinscopedecls' to define the labels. (Rom Praschan,
closes #10109)
|
|
Problem: The EBCDIC support is outdated.
Solution: Remove the EBCDIC support.
|
|
Problem: Line comment start is also found in a string.
Solution: Skip line comments in a string.
|
|
Problem: Various spelling mistakes in comments.
Solution: Fix the mistakes. (Dominique Pellé, closes #9416)
|
|
Problem: 'cindent' does not recognize inline namespace.
Solution: Skip over "inline" to find "namespace". (closes #9383)
|
|
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.
|
|
Problem: Illegal memory access when C-indenting.
Solution: Also set the cursor column.
|
|
Problem: Reading beyond end of line ending in quote and backslash.
Solution: Check for non-NUL after backslash. (closes #8964)
|
|
Problem: Vim9: runtime and compile time type checks are not the same.
Solution: Add more runtime type checks for builtin functions. (Yegappan
Lakshmanan, closes #8646)
|
|
Problem: Computing array length is done in various ways.
Solution: Use ARRAY_LENGTH everywhere. (Ken Takata, closes #8305)
|
|
Problem: Various typos.
Solution: Fix spelling mistakes. (closes #7494)
|
|
Problem: Pragmas are indented all the way to the left.
Solution: Add an option to indent progmas like normal code. (Max Rumpf,
closes #5468)
|
|
Problem: Illegal memory access when using 'cindent'.
Solution: Check for NUL byte. (Dominique Pelle, closes #5470)
|
|
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
|
|
Problem: Typos in comments.
Solution: Fix the typos. (Dominique Pelle, closes #5160) Also adjust
formatting a bit.
|
|
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 #5031)
|