jongjcho94
Hello, We recently ran the static analysis using MathWorks Polyspace on the libmodbus module located in OpenPLC_v3/utils/libmodbus_src. We used both Polyspace Code Prover and Polyspace Bug Finder. 

Here are our results:

Polyspace Code Prover is a static analysis tool that rigorously proves the absence of run-time errors and undefined behaviors in C, C++, and Ada code without executing the program. It provides formal verification by analyzing source code to identify potential issues such as array bounds violations, division by zero, and invalid pointer accesses, ensuring code reliability and safety.

The code prover components are considered as follows: 

Red: A link to the error message associated with the error which occurs at every execution.
Orange: A link to an unproven message - an error may occur sometimes.
Grey: A link to a check is shown as an unreachable code. The error message is in grey.
Green: A link to a VOA (Value on Assignment) or an error condition that will never occur.
 
The reports are reported as follows: 
Number of Red Check 3 
Number of Gray Check 61 
Number of Orange Check 418
Number of Green Check 4057 
Proven 90.8%

Polyspace Bug Finder is a static analysis tool that detects coding errors and potential vulnerabilities in C, C++, and Ada code by scanning the source code. It identifies issues such as coding rule violations, concurrency problems, and security vulnerabilities, providing actionable insights for improving code quality early in the development process.
The bug finder components are considered as follows. 
 
High Severity: Indicates critical issues like security vulnerabilities, critical run-time errors, or data corruption that must be fixed immediately.
 
Medium Severity: Represents significant issues affecting functionality, performance, or stability, requiring attention after high severity issues are resolved.
 
Low Severity: Denotes minor problems or deviations from best practices that are less urgent but should be addressed to improve code quality and maintainability.

The reports are reported as follows: 
High - 35 
Medium - 27 
Low - 81 
 
I am attaching full reports on both code prover and bug finder on this report.
 
Full Credit to JongJin Cho and SeungHo Yoon
Reply 0 0
thiagoralves
Thank you for the report. Probably the best thing to do is update the libmodbus library which might have many of these bugs fixed. However, updating it will require extensive testing to make sure nothing has changed on the API with the newer version.
Reply 0 0
Write a reply...
Reply