Preface
In the realm of programming, the integrity of source code is crucial. Recently, I embarked on a quest to develop a small yet powerful tool to address this concern.
cvc – a program crafted to examine C/C++ source code, ensuring that it adheres to the rules of the basic source character set as defined in the C standard.
Idea
The idea was born a few years ago, when I first started learning about the character set of C source code. The reason for this was that I wanted to create a PDF file with Doxygen for the documentation of code. The LaTeX engine stumbled over an "@" character that was not escaped correctly. I then found out that this character is not included in the basic source character set and the behaviour of the programs that process the source code with such characters is undefined.
This problem emphasized the need for a tool like cvc - one that can detect such discrepancies in advance, potentially saving hours of troubleshooting.
Source Code Vulnerabilities
I found another reason for such a tool, when I learned about security vulnerabilities lurking within source code. Special Unicode control characters, if left unchecked, possess the ominous capability to subvert the intended functionality of code, opening doors to malicious exploits. For those interested in delving deeper into this topic, I recommend Trojan Source Attacks↗.
Implementation
True to the ethos of the UNIX philosophy, cvc adheres to the principle of doing one thing and doing it well. Its design enables seamless integration into existing workflows and facilitates synergy with companion tools such as grep, find, cat and others.
Get It!
Please find it at the GitHub repository↗.
Published: