-
Notifications
You must be signed in to change notification settings - Fork 52
external c functions incorrectly accepted as safe #22
Comments
Another example:
This is even simpler and simply unsafe. |
thank you for the report. still unsure if
|
If you focusing on safety, everything which is not proven or assumed explicitely, should be unsafe. |
i would go with an explicit unsafe block. |
It should at least emit a warning, especially for known-unsafe c functions (e.g. like References:
inherently vulnerable/unsafe C functions:
|
this is currently blocked because an unsafe block is a scope, so this is not possible:
and initialization in unsafe breaks SMT.
i'll either need to make unsafe an expression instead of a scope
which means you need to wrap every call in unsafe rather than an entire list of statements. or make it a block but ignore scoping so this is valid but harder to understand:
another option is forcing c calls through a macro
the macro can do additional checks in first class library code rather than in the compiler |
Could it be possible to make |
unsafe is now available in expression position: int e = unsafe<int>(errno); |
I played a bit, and this compiles:
this should be unsound for len(stdin) > 2 or 1 (depends on NUL-byte or not)
ASAN finds this at runtime, but it feels unsound.
The text was updated successfully, but these errors were encountered: