-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more safety checks to variadic function calls in checked scope #1182
Conversation
The checking of variadic functions in checked scope follows these rules: 1. All warnings issued by the -Wformat family of flags are errors in checked scope. 2. No bounds checking of arguments to variadic functions like printf/scanf, etc is done. For printf-like functions: 3. %s is allowed only with arg type _Nt_array_ptr or _Nt_checked. 4. %p is allowed with any arg type. 5. %n is disallowed. 6. For all other format specifiers, only scalar arg types are allowed. For scanf-like functions: 7. %s is disallowed. 8. All width modifiers to format specifiers are disallowed. 9. %p is disallowed 10. %n is disallowed 11. For all other format specifiers, only _Ptr arg types are allowed.
It looks like this PR closes off all the safety holes in #1178 except |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thank you!
Co-authored-by: Matt McCutchen (Correct Computation) <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
The checking of variadic functions in checked scope follows these rules:
scope.
etc is done.
For printf-like functions:
3. %s is allowed only with arg type _Nt_array_ptr or _Nt_checked.
4. %p is allowed with any arg type.
5. %n is disallowed.
6. For all other format specifiers, only scalar arg types are allowed.
For scanf-like functions:
7. %s is disallowed.
8. All width modifiers to format specifiers are disallowed.
9. %p is disallowed
10. %n is disallowed
11. For all other format specifiers, only _Ptr arg types are allowed.