-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fix u32 to s32 in two functions in #17666 #17840
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
Conversation
|
A pitch is the number of bytes in a row (including padding). |
|
Meaning there's no bug. |
those have been also my first considerations (for that reasons I also provided some doubts and notes) but those changes restored the same arithmetic and have been confirmed in #17730 as fixing the issue. |
Hiding the issue and fixing the issue are 2 different things. We're not interested in hiding bugs to sweep them under the rug. Now we'll need an explanation why it was underflowing before moving on. |
kd-11
left a comment
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 just hides the issue. It's either:
- We cannot have negative pittch and something is underflowing.
- We can pass negtive pitch to nv0039 and we do not correctly support it.
Note all the other logic in the file is explicitly written to support positive integers. The in and out pitch being s32 is a coincidence/bug here, those variables should also be u32 to match the register decoded output.
|
My suggestion here is this:
That's pretty much how all the features are reversed and worked on. |
|
well. it would kinda make sense if you want to mirror some memory |
yes, I simply restored the previous (apparently not crashing) logic, received feedback as no more issue and shared info, doubts in order to request a cross check from devs for possible hidden bugs or not properly managed logic. I would say this PR reached its scope and likely deserve to be closed and replaced by a PR (from main developers) collecting the needed info for a possible specific bugfix |
fixes #17730
Fix signature for the following utility functions implemented in #17666:
Variables
in_pitchandout_pitchare defined ass32but passed asu32on those functions so breaking the arithmetic on pointers (e.g.src += src_pitch;) in case of negative pitch value.Just a doubt about:
REGS(ctx)->nv0039_input_pitch()andREGS(ctx)->nv0039_output_pitch()returnu32but assigned tos32. Not sure if intended or a possible bug to fix. Apparently it seems intended (e.g. negative values are possible; otherwise this bugfix should not exist) although I don't understand whyREGS-><xx>_pitch()have been defined asu32.NOTE:
Similarly to the reported two bugged functions, I also see in #17666 the use of function
clip_image(....). e.g.:clip_image(dst.pixels, src.pixels, dst.clip_x, dst.clip_y, dst.clip_width, dst.clip_height, dst.bpp, src.pitch, dst.pitch);Many of the passed variables have a different (and dangerous) type than what the function is expecting. E.g.
src.pitchisu32(whilein_pitchwass32) while the function's signature is expecting anint(although on a 64bit arch int should be equivalent iirc tos64so coveringu32. Similar considerations for other arguments.Just in case it could be something to review and fix to avoid a similar issue as the one fixed by this PR