darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.64k stars 1.13k forks source link

Zooming in to 800% or 1600% when "denoise (profiled)" module is on with mode "wavelets" cause darktable to crash #4087

Closed lukkepcz closed 4 years ago

lukkepcz commented 4 years ago

Describe the bug

Zooming in to 800% or 1600% when "denoise (profiled)" module is on with mode set to "wavelets" cause darktable to crash with "An unhandled exception occured" box showing up. The same behaviour observed when zoom is set to 1600% or 800% and "denoise (profiled)" module with the same mode is activated.

To Reproduce

  1. Go to 'Correction group'
  2. Click on 'Denoise (profiled)'
  3. Set 'mode' to 'wavelets'
  4. Change zoom to 1600% either by clicking 1600% or scrolling mouse wheel with Ctr
  5. See error

Alternatively:

  1. Go to 'Correction group'
  2. Click on 'Denoise (profiled)'
  3. Set 'mode' to 'wavelets'
  4. Deactivate 'Denoise (profiled)' module
  5. Change zoon to 1600%
  6. Activate 'Denoise (profiled)' module
  7. See error

Expected behavior

Should not crash

Screenshots

Error

Platform (please complete the following information):

Additional context

This is observable either with previously edited and with new raws. Backtrace file is usually almost empty, I also add another bactrace file generated after the same error but with content.

darktable_bt_68B0D0.txt darktable_bt_6FB0D0.txt

aurelienpierre commented 4 years ago

Does not reproduce on Linux (Intel® Xeon(R) CPU E3-1505M v6 @ 3.00GHz × 8).

rawfiner commented 4 years ago

I can reproduce on linux I will debug it

lukkepcz commented 4 years ago

I wanted to write a "thank you" comment but I think I accidentaly closed the issue :( I'm sorry, how to undo that?

Addeneum: Guys, I'm both darktable and github newbie. Sorry for doing all the mess

upegelow commented 4 years ago

I will debug it

Maybe related to the issue tackled in PR #4076

rawfiner commented 4 years ago

@upegelow Indeed! I'll check by building, but looking at the change of your PR I am quite confident it fixed this bug :-) Thank you!

upegelow commented 4 years ago

Maybe a second thought on my commit is justified.

It deals with issues like in

https://github.com/darktable-org/darktable/blob/6d897ea0eca02b7f550e6814006fb51f419c2100/src/iop/atrous.c#L518-L529

However, could there be situations where 2 * mult is below 5 and we get out of bounds due to the inner loops?

rawfiner commented 4 years ago

I've just pulled and build, and the issue is gone.

2 * mult is below 5 for the scale 0 and the scale 1 (mult = 1 << scale), but I don't see how we can get out of bounds with the inner loop. In the inner loops, SUM_PIXEL_CONTRIBUTION_WITH_TEST is used whenever an out of bound index would be possible I think, and it tests and corrects it if needed

upegelow commented 4 years ago

Sounds reasonable. Should be fine then.

aurelienpierre commented 4 years ago

Closing then, feel free to reopen if needed.