Fix crash in scalepixels when used with rotate-and-perspective module#20706
Conversation
* Compute x_scale/y_scale locally in process() from actual roi_in/roi_out instead of using d->x_scale/d->y_scale which can be overwritten by precalculate_scale() called from distort_transform/distort_backtransform with different ROI dimensions, causing out-of-bounds interpolation access. * Implement distort_mask() enabling masks to work correctly when module is at non-standard pipeline position. * Fix buffer overflow in (ashift.c) g->buf allocation: the buffer was allocated using piece->buf_in.width * piece->buf_in.height but then filled with roi_in->width * roi_in->height * 4 floats. When roi_in->scale > 1.0 (zoomed in), roi_in dimensions exceed buf_in, causing a ~6.6 MB write past the end of the buffer. Fixed in both the CPU path (process()) and OpenCL path (process_cl()) by changing requested_size, g->buf_width, and g->buf_height to use roi_in dimensions instead of piece->buf_in.
|
I did some intensive testing and could not reproduce the crash mentioned in #17286. |
|
Indeed the ashift code was simply not prepared to do some "upscaling".
Good to me. |
|
Very sad to see AI generated code merged. I have been a happy darktable user for a few years, but I will now be looking for alternatives. |
I also got really, really upset when I saw people using code from Stack Overflow. It made me so sad to see that, that I'm now relieved that LLM is helping people. LLMs explain their advice much better, so people get more knowledge than mindlessly copying someone else's code from SO.
@Leon-Plickat The only thing I can say to that is Please do what makes you happy. That's the main thing! |
|
Please, let's not start this discussion all over again, there is already a very lenghty post on pixls.us about this topic: This is not the right place to discuss this topic. |
|
The relevant point, whatever the origin of a pr is, it gets reviewed. |
Compute
x_scale/y_scalelocally inprocess()from actualroi_in/roi_outinstead of usingd->x_scale/d->y_scalewhich can be overwritten byprecalculate_scale()called fromdistort_transform/distort_backtransformwith different ROI dimensions, causing out-of-bounds interpolation access.Implement
distort_mask()enabling masks to work correctly when module is at non-standard pipeline position.Fix buffer overflow in (ashift.c)
g->bufallocation: the buffer was allocated usingpiece->buf_in.width * piece->buf_in.heightbut then filled withroi_in->width * roi_in->height * 4 floats. Whenroi_in->scale > 1.0(zoomed in),roi_indimensions exceedbuf_in, causing a write past the end of the buffer. Fixed in both the CPU path (process()) and OpenCL path (process_cl()) by changingrequested_size,g->buf_width, andg->buf_heightto useroi_indimensions instead ofpiece->buf_in.Fixes #17286
Disclaimer: co-created with Claude.