Bug hunting: Added CVE test case

This commit is contained in:
Daniel Marjamäki 2020-05-01 13:59:17 +02:00
parent daae26c474
commit 1683bd38d1
4 changed files with 2129 additions and 1 deletions

View File

@ -18,9 +18,11 @@ RUN_CLANG = ('--clang' in sys.argv)
def check():
cmd = [CPPCHECK_PATH,
'-D_GNUC',
'--bug-hunting',
'--platform=unix64',
'--inline-suppr',
'--enable=information',
TEST_SUITE]
if RUN_CLANG:
cmd.append('--clang')
@ -34,6 +36,7 @@ def check():
# Ensure there are no unmatched suppressions
if '[unmatchedSuppression]' in stderr:
print('FAILED: There are unmatched suppressions')
sys.exit(1)
else:
print('SUCCESS')

View File

@ -0,0 +1,10 @@
Division by zero
Details:
https://nvd.nist.gov/vuln/detail/CVE-2019-14249
Fix:
https://sourceforge.net/p/libdwarf/code/ci/cb7198abde46c2ae29957ad460da6886eaa606ba/tree/libdwarf/dwarf_elf_load_headers.c?diff=99e77c3894877a1dd80b82808d8309eded4e5599

File diff suppressed because it is too large Load Diff

View File

@ -2124,7 +2124,7 @@ static void setup_format_params(int track)
head_shift = (F_SECT_PER_TRACK + 5) / 6;
/* a ``cylinder'' is two tracks plus a little stepping time */
track_shift = 2 * head_shift + 3; // cppcheck-suppress bughuntingDivByZero
track_shift = 2 * head_shift + 3;
/* position of logical sector 1 on this track */
n = (track_shift * format_req.track + head_shift * format_req.head)