CCured
George C. Necula, Scott McPeak, Westley R. Weimer · ACM SIGPLAN Notices · 2012
In this paper we propose a scheme that combines type inference and run-time checking to make existing C programs type safe. We describe the CCured type system, which extends that of C by separating pointer types according to their usage. This type sysiem allows both pointers whose usage can be verified statically to be type safe, and pointers whose safety must be checked at run time. We prove a type soundness result and then we present a surprisingly simple type inference algoriihm that is able lo infer the appropriate pointer kinds for existing C programs. Our experience wiih the CCured sysiem shows that the inference is very effective for many C programs, as it is able to infer that most or all of the pointers are statically verifiable to be type safe. The remaining pointers are instrumented wiih efficient run-time checks to ensure that they are used safely. The resulting performance loss due to run-time checks is 0-150%, which is several times better than comparable approaches thai use only dynamic checking. Using CCured we have discovered programming bugs in established C programs such as several SPECINT95 benchmarks.
Cited by 502 works. doi:10.1145/2442776.2442786
Authors
References
- A First Step Towards Automated Detection of Buffer Overrun Vulnerabilities.
- CLU Reference Manual
- Garbage collection in an uncooperative environment
- Efficient detection of all pointer and array access errors
- Static detection of dynamic memory errors
- Backwards-Compatible Bounds Checking for Arrays and Pointers in C Programs
- Dynamic typing in a statically typed language
- Soft typing
- Adding run‐time checking to the portable C compiler
- Aggregate structure identification and its application to program analysis