wazuh
wazuh copied to clipboard
Fix UBS errors in vuln detector UTs.
| Related issue |
|---|
| Closes #14149 |
Description
This PR aims to fix the runtime errors detected by UBS (undefined behavior sanitizer) while running the Vulnerabilty Detector UTs
Configuration options
All the tests were run using Ubuntu 22.04.
Logs/Alerts example
root@ubuntumanager:/home/vagrant/wazuh/src/unit_tests/build/wazuh_modules/vulnerability_detector# ctest
Test project /home/vagrant/wazuh/src/unit_tests/build/wazuh_modules/vulnerability_detector
Start 1: test_wm_vuln_detector
1/3 Test #1: test_wm_vuln_detector ............ Passed 0.08 sec
Start 2: test_wm_vuln_detector_evr
2/3 Test #2: test_wm_vuln_detector_evr ........ Passed 0.02 sec
Start 3: test_wm_vuln_detector_nvd
3/3 Test #3: test_wm_vuln_detector_nvd ........ Passed 0.05 sec
100% tests passed, 0 tests failed out of 3
Total Test time (real) = 0.14 sec
Results of the test:
/home/vagrant/wazuh/src/unit_tests/build/wazuh_modules/vulnerability_detector/Testing/Temporary/LastTest.log
Tests
- Compilation without warnings in every supported platform
- [x] Linux
- [x] Source installation
- [x] Source upgrade
No warnings are generated after changing the base:
root@ubuntuagent:/home/vagrant/wazuh/src/unit_tests/build/wazuh_modules/vulnerability_detector# ctest
Test project /home/vagrant/wazuh/src/unit_tests/build/wazuh_modules/vulnerability_detector
Start 1: test_wm_vuln_detector
1/3 Test #1: test_wm_vuln_detector ............ Passed 0.12 sec
Start 2: test_wm_vuln_detector_evr
2/3 Test #2: test_wm_vuln_detector_evr ........ Passed 0.02 sec
Start 3: test_wm_vuln_detector_nvd
3/3 Test #3: test_wm_vuln_detector_nvd ........ Passed 0.06 sec
100% tests passed, 0 tests failed out of 3
Total Test time (real) = 0.21 sec
root@ubuntuagent:/home/vagrant/wazuh/src/unit_tests/build/wazuh_modules/vulnerability_detector# grep "runtime error" Testing/Temporary/LastTest.log
root@ubuntuagent:/home/vagrant/wazuh/src/unit_tests/build/wazuh_modules/vulnerability_detector#