Bug hunting: Add CVE test suite
This commit is contained in:
parent
ef2e272f20
commit
daae26c474
|
@ -0,0 +1,41 @@
|
|||
# Test if --bug-hunting works using cve tests
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
if sys.argv[0] in ('test/bug-hunting/cve.py', './test/bug-hunting/cve.py'):
|
||||
CPPCHECK_PATH = './cppcheck'
|
||||
TEST_SUITE = 'test/bug-hunting/cve'
|
||||
else:
|
||||
CPPCHECK_PATH = '../../cppcheck'
|
||||
TEST_SUITE = 'cve'
|
||||
|
||||
RUN_CLANG = ('--clang' in sys.argv)
|
||||
|
||||
def check():
|
||||
cmd = [CPPCHECK_PATH,
|
||||
'--bug-hunting',
|
||||
'--platform=unix64',
|
||||
'--inline-suppr',
|
||||
TEST_SUITE]
|
||||
if RUN_CLANG:
|
||||
cmd.append('--clang')
|
||||
print(' '.join(cmd))
|
||||
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
comm = p.communicate()
|
||||
stdout = comm[0].decode(encoding='utf-8', errors='ignore')
|
||||
stderr = comm[1].decode(encoding='utf-8', errors='ignore')
|
||||
|
||||
# Ensure there are no unmatched suppressions
|
||||
if '[unmatchedSuppression]' in stderr:
|
||||
print('FAILED: There are unmatched suppressions')
|
||||
else:
|
||||
print('SUCCESS')
|
||||
|
||||
|
||||
check()
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
Details:
|
||||
https://nvd.nist.gov/vuln/detail/CVE-2019-14284
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue