Resolving function pointers with static analysis

February 27, 2018 Mark Hermeling, GrammaTech

Function pointers in C are a useful construct, despite needing to look up the exact syntax when trying to program with them. They are potentially dangerous if misused since program execution can go to unwanted location. In fact, coding standards like MISRA C (e.g. rule 104) forbid the use of variable function pointers. If you are using function pointers, it can be tricky to figure out where they are pointing to. Luckily, a new function pointer resolver has been published to our customer community site for CodeSonar users.

The function pointer resolver makes use of our extension API to extend our existing set of rules. Once installed it can help identify which functions a pointer can point based on the abstract execution that CodeSonar performs during static analysis of the code. See the following screenshot.

 

Mark Hermeling, MSc has 15+ years of experience in software development tooling, operating systems, virtualization and networking technology in safe and secure, embedded and real-time systems. He has worked on projects building automotive, networking, aerospace and defense and industrial devices in North America, Europe and Asia. At GrammaTech, Mark is the Senior Director of Product Marketing, directing GrammaTech’s commercial software product and business development efforts. Prior to joining GrammaTech worked for Wind River Systems (an Intel Corporation subsidiary), Zeligsoft and IBM Rational. Mark holds a Master of Science degree in Computing Science from Eindhoven University of Technology for research into timing constraints overlaid on object-oriented languages. 

Previous Article
Connectivity looks prominent in infotainment's 2018 diary
Connectivity looks prominent in infotainment's 2018 diary

During the past six months or so, major infotainment announcements feature connectivity as the key design t...

Next Article
Open source RISC-V architecture is changing the game for IoT processors
Open source RISC-V architecture is changing the game for IoT processors

The power of open source, the freedom it enables, and the communities that it generates are gaining tractio...