Skip to content

Fix raw denoise crash on raws with tight CFA border#21500

Merged
TurboGit merged 1 commit into
darktable-org:masterfrom
andriiryzhkov:fix_21497
Jul 7, 2026
Merged

Fix raw denoise crash on raws with tight CFA border#21500
TurboGit merged 1 commit into
darktable-org:masterfrom
andriiryzhkov:fix_21497

Conversation

@andriiryzhkov

Copy link
Copy Markdown
Collaborator

Closes #21497

dt_restore_raw_bayer's per-tile "extended extent" adds sensor_O pixels on any side with a neighbour tile, but doesn't clamp to the CFA buffer bounds. On raws where the visible area sits tight against the sensor edge (e.g. visible 3632x2720 in a 3648x2736 sensor) the extension overshoots the buffer and cfa_in[sr * width + sc] reads past the allocation – classic MALLOC_LARGE gap crash.

Fix: clamp the four extents in restore_raw_bayer.c to [0, width) × [0, height). Interior tiles unchanged; boundary tiles get clipped to what actually exists.

@andriiryzhkov andriiryzhkov added this to the 5.6.1 milestone Jul 6, 2026
@andriiryzhkov andriiryzhkov added bugfix pull request fixing a bug scope: AI features AI features related issues and PR labels Jul 6, 2026

@TurboGit TurboGit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TurboGit TurboGit merged commit 4fdc687 into darktable-org:master Jul 7, 2026
5 checks passed
@TurboGit

TurboGit commented Jul 7, 2026

Copy link
Copy Markdown
Member

Needs a release note entry, TIA.

@andriiryzhkov andriiryzhkov deleted the fix_21497 branch July 8, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug release notes: pending scope: AI features AI features related issues and PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when processing (neural restore) raw denoise with DNG from specific (tele) phone camera lens

2 participants