-
Notifications
You must be signed in to change notification settings - Fork 8
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
Missing compile-time warnings when compiling with OpenOSC #6
Comments
Thanks for reporting this issue. There seems some difference between "char src[] = " and "char *src = ". For the first one, somehow, the compiler fails to know the src string length is constant. If I change the definition of src to "char *src =", then OpenOSC is able to catch the overflow at compile time.
Perhaps this is because "char src[] = " defines a memory region on the stack, while "char *src =" defines a pointer which points to memory in read-only section not on the stack? For comparison, I tried clang-14, which also fails to catch this overflow at compile time. root@2751ad9120bb:/home/openosc-dir/fuzz# ls -tl fuzzer2.o fuzzer.o I will see if I can improve OpenOSC code for this case. |
Example:
fuzzer.c:
Makefile:
Result:
Now add
-include openosc.h
toCFLAGS
,Makefile:
And run
make
again:The compile time errors have disappeared and have been moved to runtime:
Using OpenOSC, we've transitioned from a program which didn't compile to an invalid program which truncates the result and reports the buffer overflow at runtime. This is opposite from what is usually desired, i.e. fail as early as possible, catch errors at compile-time rather than at runtime.
The text was updated successfully, but these errors were encountered: