PrincetonUniversity / VST

Verified Software Toolchain
https://vst.cs.princeton.edu
Other
436 stars 92 forks source link

strcmp code and spec #667

Closed dnaumann closed 1 year ago

dnaumann commented 1 year ago

verif_stlib has a spec for strcmp and there's a verified implementation of strcmp in strlib.c. But the code is wrong relative to the Posix-etc specs which say unsigned char comparison should be used. The code can be fixed by adding a casts to unsigned char. The current spec is too weak, the postcondition requires only equality/disequality which explains the bug slipping through.

This issue was found by Frederico Ramos, a student of José Santos at Instituto Superior Técnico, Lisbon, using symbolic execution.