-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Possible memory violation in sf::Texture::loadFromImage #3345
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
Comments
What's |
there is no _h. it is 150x150 only _w. the image size 3750 x 150 |
actually it can be a broader issue. here is the min example
I link with
on Ubuntu24 and it seems to always data race with iris driver
|
The last part sounds like a driver bug (see also iris_dri). Any reason you're not just using |
I don't use find_package as I compile SFML myself and for android as well from the same src folder. it is not installed in the system, I can just fetch from git and rebuild new version into build folder. I have 2 ideas at this time. When SFML init GL context. iris driver starts some threads that mess up memory of the whole program. |
I have not used ThreadSanitizer myself, but my understand is that using TSan requires compiling all dependencies with TSan as well. Have you done that? |
Hm, I compiled SFML with sanitizer flag as well and it just gives me more debug trace:
This particular issue I think is due to the driver or OS or sanitizer itself. its on ubuntu24 which is still quite raw and buggy. However check Texture.loadFromImage function if it does not read memory out of bounds on the edge cases where rect area == image.width/height |
This question of mine still stands. ThreadSanitizer is not as straightforward to enable as ASan or UBSan. |
I'm closing this issue until I hear back on whether TSan was being set up properly or if this issue can be recreated with AddressSanitizer. |
Prerequisite Checklist
Describe your issue here
bool sf::Texture::loadFromImage ( const Image & image, const IntRect & area = IntRect() )
I am running the build with thread sanitizer and I have reason to believe that this function violates the memory if area goes out of bounds. As I get sanitizer issue 100% of a time after I call this function.
Here I have an image. with the size 3750 x 150
and I load animation frames into textures of 150 x 150
So if I change IntRect to be (x, 0) (_w - 1, _w -1) I get no sanitizer issue. So I assume there still was some memory violation trying to load from image on the bounds.
Here is the sanitizer issue:
Your Environment
Steps to reproduce
Sorry I don't have time to produce the minimum example. Also the issue is not easy to trigger as it requires some memory work after the function under sanitizer mode to even notice the problem.
But generally just load a bunch of images with this function
Expected behavior
No Sanitizer issues
Actual behavior
Sanitizer report memory access data race after loading textures from image class at exact image bounds.
The text was updated successfully, but these errors were encountered: