-
Notifications
You must be signed in to change notification settings - Fork 14
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
256x1 image fails to decode (crash) #18
Comments
gcc ./test.c -O0 -o test -ggdb -fsanitize=address
|
|
I found two problems with the program which both cause buffer overruns..
This could be fixed by adding a BCDEC_MAX1 macro #define BCDEC_MAX1(i) (i < 1 ? 1 : i)
...
#define BCDEC_BC3_COMPRESSED_SIZE(w, h) (((BCDEC_MAX1((w)>>2))*(BCDEC_MAX1((h)>>2)))*BCDEC_BC3_BLOCK_SIZE)
|
Hi! The test app is just a simple use case to demonstrate the bcdec API and for me to test and profile the library. The BC format operates on blocks of size 4, and so every function expects input as an array of 4x4 and same for the output. As for the issue in Godot - it should be addressed by the person who integrated the library, and it looks like that person already addressed this in this commit - godotengine/godot@a60195e. |
Thanks, I feel the example code should test the edge cases as well though. The person who integrates the library won't know about them if you don't put them in the example test code :D I ended up spending most of my day trying to figure this out, some comments for the function definitions specifying their requirements explicitly would go a long way. (I did learn a lot about BC decoding though along the way) |
For sure I can add this to the test app, but to be completely honest - this is specifically mentioned in the README of the library
But anyways, I'll think on how to make it even more obvious thanks. |
Found on godot engine when bcdec was integrated..
godotengine/godot#98902
The test program crashes while decoding the following test image:
256x1_test_image.zip
The issue on godot is a bit different,
The text was updated successfully, but these errors were encountered: