-
-
Notifications
You must be signed in to change notification settings - Fork 21.2k
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
Executing Image.save_jpg_to_buffer
function crashes Godot
#90715
Comments
I tested your code and the crash did not occur, but in any case there are several incorrect uses of this code, follow the details:
Adjust the script to something within the expected usage, as described in the documentation and try to reproduce the crash, providing an MRP.
|
Did you tried to use builds with sanitizer? This builds should show same error as in first post. The fuzzer's job is to find the smallest possible code to create a memory leak or crash(incorrectly used memory does not always cause problems, but this is seen much better with address sanitizer). Usually this is code that users would never use in a released program, but it can happen that during testing they accidentally use something like this and this code can produce unexpected results. |
If the idea is to look for failures caused by incorrect use of the code, by accident, then the correct thing is for the user to read the documentation or ask on a site like Stack Overflow (or even some AI site, eg.: ChatGPT) how to correctly use such a function, or ask for an example of correct use. Does the crash occur if you use the functions as documented? As I described in the topics of my previous comment. Review the code and see if it still reproduces the issue. 👍 |
For 99.9%, the error will not occur if even one line from the above code is changed. The errors themselves in the logs obviously help the user to understand that they have made a mistake and should look at the documentation, but these errors should not cause the program to break memory or randomly shut down, which is what they do here and should be fixed because it is not the user's expectation of the program's operation. |
Regardless of language, compilers/transpilers cannot predict or understand completely wrong usage, with incoherent values. They also cannot predict memory management problems, this is something beyond the language and the compiler, as there are things that can work to a certain level, but the person who manages or even kills/locks processes could be the operating system. In any language you will see problems like this, when the user does random things, testing inconsistent values, and the compilers cannot fully predict. Ideally, you should use documentation when writing line by line, and not just when a failure occurs. Some points to reinforce:
I hope I was able to guide you. I wish you good luck in your projects. 👍 |
This is a crash report, qarmin doesn't need help. Godot should ideally never crash, even with erroneous inputs. The function should instead cleanly refuse to execute or something. |
|
Tested versions
4.3.dev. 4728ff3
System information
Ubuntu 22.04 CI
Issue description
When executing (this code was automatically minimized, so it is possible, that an even more "minimal" project can be created)
Godot crashes:
This example was found by Godot fuzzer - Qarminer, so it is quite unlikelly that this code could be used in real project, but still this should be handled gracefully.
Memory leaks or asan backtraces are visible when using Godot build with sanitizers support - https://github.com/qarmin/GodotBuilds/actions (linux -> linux-editor-sanitizers)
Steps to reproduce
Above
Minimal reproduction project (MRP)
Above
The text was updated successfully, but these errors were encountered: