-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix irrString use-after-free with char-like assignment (operator=) #15213
Fix irrString use-after-free with char-like assignment (operator=) #15213
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be good
This comment was marked as outdated.
This comment was marked as outdated.
Once someone tests the early return (I did and it works), then it's ready to merge 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the logic I want to see. Bringing examples/AutomatedTest/test_string.cpp
back could be considered but wouldn't be very useful given that we want to get rid of core::string
anyways.
Im definitely against bringing the tests back for now. Let's move to our own string utility soon :) |
It's ready for merge when anyone is ready |
Why do we need |
I'd say its more of a compatibility thing. It's just leftover junk from Irrlicht, so I don't want to bother wiping it over. But I personally wouldn't have considered any of this and would've just hacked in utf8 checking |
I'll fix changes when I get off work |
It's not trivial to remove (and needn't be refactored in this PR) because it's used for unsigned - signed conversions (which don't do anything though, essentially it's just a type cast). For example unsigned char to signed char. But that case is covered by checking for equal |
I think it's used for some |
…trupstrup idk how to spell his name
…x-string-charlike-copy-use-after-free
…trupstrup idk how to spell his name
Fixed kings. Sorry I can't git. |
It's ready, for real, I hope. |
It's ready, for real, I hope. |
Tysm sfan for force pushing those, i was getting tired of this PR 😄 Thank you all for all the feedback and advice! |
Thank you @appgurueu for suggesting use of resizing instead of making a temporary copy.
Technically fixes #15211, but I'd still like to greenlight that PR for merging.
This is a use-after-free. It is probably a bit serious but otherwise nothing dangerous as it's re-size dependent. This operator is used a lot throughout irrlicht.
My old code
Here's my old code which does a copy, if you need it.