clamav/unit_tests
Micah Snyder 902623972d Remove max-allocation limits where not required
The cli_max_malloc, cli_max_calloc, and cli_max_realloc functions
provide a way to protect against allocating too much memory
when the size of the allocation is derived from the untrusted input.
Specifically, we worry about values in the file being scanned being
manipulated to exhaust the RAM and crash the application.

There is no need to check the limits if the size of the allocation
is fixed, or if the size of the allocation is necessary for signature
loading, or the general operation of the applications.
E.g. checking the max-allocation limit for the size of a hash, or
for the size of the scan recursion stack, is a complete waste of
time.

Although we significantly increased the max-allocation limit in
a recent release, it is best not to check an allocation if the
allocation will be safe. It would be a waste of time.

I am also hopeful that if we can reduce the number allocations
that require a limit-check to those that require it for the safe
scan of a file, then eventually we can store the limit in the scan-
context, and make it configurable.
2024-03-15 13:18:47 -04:00
..
clamscan test: Check clamscan --scan-image and --scan-image-fuzzy-hash 2024-03-14 16:57:48 -04:00
examples Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
input Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
check_bytecode.c Remove max-allocation limits where not required 2024-03-15 13:18:47 -04:00
check_clamav.c Remove max-allocation limits where not required 2024-03-15 13:18:47 -04:00
check_clamav_skip.c bb12596: Fix build issue when libcheck missing 2020-08-24 15:11:07 -07:00
check_clamd.c Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
check_disasm.c Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
check_fpu_endian.c Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
check_htmlnorm.c Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
check_jsnorm.c Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
check_matchers.c Remove max-allocation limits where not required 2024-03-15 13:18:47 -04:00
check_regex.c Optimization: replace limited allocation calls 2024-03-15 13:18:47 -04:00
check_str.c Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
check_uniq.c Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
checks.h CMake: Add CTest support to match Autotools checks 2021-02-25 11:41:26 -08:00
clamd_test.py Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
CMakeLists.txt Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
freshclam_test.py Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
libclamav_test.py Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
Run-GetLibs.ctest Test: fix check_clamd failure on Windows 2021-03-22 19:50:48 -07:00
sigtool_test.py Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
testcase.py Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
valgrind.supp CMake: Fix LLVM linking issues: libclamav_rust, -ltinfo 2022-03-09 20:35:42 -08:00