-
Notifications
You must be signed in to change notification settings - Fork 199
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
IMG_LoadTexture_RW read too much data, far beyond the end of the PNG data #360
Comments
You should not assume how much data will be read by an image decoder. If you are storing data in a stream you should have a directory of where each piece of data is located and skip to the next asset using that. A ZIP directory or RIFF chunk format has these properties. |
This is not true. The format specification clearly states that the
Attempting to read data after an There is also a mention in the security section that data after the
For this reason, other decoders, including the one implemented in the Free Pascal runtime library, terminate reading on the |
That's a good point. Could you check which decoder is being used in your case and submit an upstream bug for that and reference it here, so we can pick up the fix when it happens? |
Ok, I've added a new report for SDL3 related features — #524. However, since I'm using Free Pascal and SDL3 as a dynamically loaded library, I'm not able to provide more information about what SDL does internally. |
The
IMG_LoadTexture_RW
function can load a PNG image saved in the stream, but if the stream contains some data after it (because it is, for example, a binary file with a lot of data), then after reading the PNG, the stream pointer is moved much too far, which further data could not be read correctly. The same problem occurs with theIMG_LoadTextureTyped_RW
function.The original discussion is here: https://discourse.libsdl.org/t/img-loadtexture-rw-seems-to-load-too-much-data
The text was updated successfully, but these errors were encountered: