-
Notifications
You must be signed in to change notification settings - Fork 816
Cmake clang tidy #1492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Cmake clang tidy #1492
Conversation
libclamav/others.c
Outdated
Check failure
Code scanning / CodeQL
Time-of-check time-of-use filesystem race condition High
filename
checked
libclamav/pe_icons.c
Outdated
| if (x + ksize > res->bright_x[j] && x < res->bright_x[j] + ksize && | ||
| y + ksize > res->bright_y[j] && y < res->bright_y[j] + ksize) | ||
| if (x + ksize > res->bright_x[j] && | ||
| x < res->bright_x[j] + ksize && |
Check failure
Code scanning / CodeQL
Multiplication result converted to larger type High
| @@ -523,22 +544,25 @@ | |||
| const char* str_end_what; | |||
| size_t cmp_len = what_len; | |||
|
|
|||
| if (begin == NULL || str_end <= sbegin) | |||
| if (begin == NULL || str_end <= sbegin) { | |||
Check failure
Code scanning / CodeQL
Redundant null check due to previous dereference High
the value is dereferenced
| } | ||
| } | ||
| ret = loc_eax; | ||
| if (lzma_upack_esi_50(p, 1, *old_ecx, old_edx, *old_edx + (loc_eax << 2), &loc_eax, bs, bl) == 0xffffffff) | ||
| if (lzma_upack_esi_50(p, 1, *old_ecx, old_edx, *old_edx + (loc_eax << 2), &loc_eax, bs, bl) == 0xffffffff) { |
Check notice
Code scanning / CodeQL
Pointer overflow check Low
Also add a couple of git checkouts to undue undesired changes to: - libclamav/nsis/bzlib.c - libclamav/nsis/infblock.c - libclamav/strlcat.c
…ents I applied the changes like this: ```bash clang-apply-replacements ./build/ ```
I discovered that clang-tidy integration in cmake is pretty good. Linting in Rust with cargo-clippy is a positive experience. So out of curiosity, I added this integration and tested auto-applying changes to enforce branches around statements.
I set up this integration so you have to very intentionally enable it by adding a cmake option like this:
-D CLANG_TIDY=clang-tidy-16. This is because: