-
Notifications
You must be signed in to change notification settings - Fork 50
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
Waving sprites with a width and height of 0 crash mkxp-z #189
Comments
That fix looks correct to me. Accessing an entry past the end of a vector causes undefined behavior. Either you're getting (un)lucky and your build of mkxp-z is consistently trying to access memory it shouldn't at that point, or your compiler is being more strict than theirs, assuming you didn't build modshot yourself, that is. |
¯\_(ツ)_/¯ I did build modshot myself? Weird |
I have reproduced waving effect on Sprite object that has 0 width or/and 0 height by using |
Resolves mkxp-z/mkxp-z#189 Fixes C++ exception (assertion fail) when getting first item from `wave.qArray.vertices`.
This is an issue present in mkxp-z but not modshot. I can't for the life of me figure out why, but when
SpritePrivate::updateWave()
is called and the sprite width and height is 0, this line of code resizeswave.qArray.vertices
to a size of 0, which then immediately crashes mkxp-z. This isn't an issue present in modshot (I haven't tested mkxp) and I can't find any significant differences insprite.cpp
that'd cause this.(log from when i was checking resizes)
A pretty hacky fix can be done to fix the bug:
I don't trust the fix though as it's not really addressing why there's a difference in behavior between modshot and mkxp-z
The text was updated successfully, but these errors were encountered: