Skip to content

Security patch from Claude Code. - #22297

Open
TurboGit wants to merge 3 commits into
darktable-org:masterfrom
TurboGit:security-patch
Open

TurboGit wants to merge 3 commits into
darktable-org:masterfrom
TurboGit:security-patch

Conversation

@TurboGit

Copy link
Copy Markdown
Member

params: validate stored module parameters before use

Module parameters are deserialized from history, sidecars, styles and presets
as binary data. Some modules used stored counts, indices and fixed-size text
fields without range-checking them, so an invalid or hand-edited parameter
block could misbehave. This bounds those values where they are used: counts
and indices are clamped before indexing, fixed-size text is read within its
field, and the LUT 3D module keeps stored names and paths out of the G'MIC
command line and confines relative paths to the LUT folder.

No parameter layout changes and no migration is needed. Valid edits render as
before. Existing compressed-LUT cache files are regenerated once, because the
cache file name changed.

Adds cmocka coverage for the curve helpers, the fixed-string copy, and the
LUT 3D count, cache-name and path checks.

Contributed by Kofa.

@TurboGit TurboGit added this to the 5.8 milestone Sep 16, 2026
@TurboGit TurboGit added bugfix pull request fixing a bug priority: high core features are broken and not usable at all, software crashes labels Sep 16, 2026
@TurboGit
TurboGit requested a review from kofa73 September 16, 2026 06:27
@TurboGit

Copy link
Copy Markdown
Member Author

@kofa73 : still something wrong with -DBUILD_TESTING=ON & cmoka.

@kofa73

kofa73 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

@kofa73 : still something wrong with -DBUILD_TESTING=ON & cmoka.

I think you didn't add any of the new unit tests I sent you in the patch.

diff --git a/src/tests/unittests/common/CMakeLists.txt b/src/tests/unittests/common/CMakeLists.txt
--- a/src/tests/unittests/common/CMakeLists.txt
+++ b/src/tests/unittests/common/CMakeLists.txt
diff --git a/src/tests/unittests/common/test_draw_curve.c b/src/tests/unittests/common/test_draw_curve.c
+++ b/src/tests/unittests/common/test_draw_curve.c
diff --git a/src/tests/unittests/common/test_fixed_strings.c b/src/tests/unittests/common/test_fixed_strings.c
+++ b/src/tests/unittests/common/test_fixed_strings.c
diff --git a/src/tests/unittests/iop/CMakeLists.txt b/src/tests/unittests/iop/CMakeLists.txt
--- a/src/tests/unittests/iop/CMakeLists.txt
+++ b/src/tests/unittests/iop/CMakeLists.txt
diff --git a/src/tests/unittests/iop/test_lut3d_bounds.c b/src/tests/unittests/iop/test_lut3d_bounds.c
+++ b/src/tests/unittests/iop/test_lut3d_bounds.c

vs

image

@TurboGit

Copy link
Copy Markdown
Member Author

I think you didn't add any of the new unit tests I sent you in the patch.

Indeed :( It is a patch and not an direct apply-mail compatible Git item, so I need to explicitly add the new files. Should be fixed, sorry for the noise.

@kofa73

kofa73 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

Hold on, there may be one more... will get back to you later

The iop bound tests were never added to CMake. The history test now
expects unterminated char arrays to be skipped.
Add a shared check that a fixed string field lies within the params
blob and is terminated, and clamp stored histogram indices.
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 priority: high core features are broken and not usable at all, software crashes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants