You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 17, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Jun 17, 2022. It is now read-only.
external c functions incorrectly accepted as safe #22
thank you for the report.
calls to libc functions cannot be proven, because they have no zz signatures.
therefor the checker is just disabled on any expression containing an external C type
still unsure if
this is fine
or require to be wrapped in an unsafe {} block
or be done like typescript where you can specify additional signatures for plain old C code.
Activity
bitwave commentedon Feb 11, 2020
Another example:
This is even simpler and simply unsafe.
aep commentedon Feb 11, 2020
thank you for the report.
calls to libc functions cannot be proven, because they have no zz signatures.
therefor the checker is just disabled on any expression containing an external C type
still unsure if
bitwave commentedon Feb 12, 2020
If you focusing on safety, everything which is not proven or assumed explicitely, should be unsafe.
peirick commentedon Feb 12, 2020
i would go with an explicit unsafe block.
fogti commentedon Feb 13, 2020
It should at least emit a warning, especially for known-unsafe c functions (e.g. like
scanfon strings,gets, etc.).References:
inherently vulnerable/unsafe C functions:
getsgetpwrewind,setbufstrcat,strcpysprintf[-]Minimal unsound example[/-][+]external c functions incorrectly accepted as safe[/+]aep commentedon Mar 30, 2020
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
fogti commentedon Mar 30, 2020
Could it be possible to make
unsafean expression, and for the less often needed block-unsafe add anunsafe_block, which creates an own scope?aep commentedon May 27, 2020
unsafe is now available in expression position: