Skip to content

fix: _remove_preset_flag crash on NULL image#990

Open
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/ansel-1k-null-image-check
Open

fix: _remove_preset_flag crash on NULL image#990
sentry[bot] wants to merge 1 commit into
masterfrom
seer/fix/ansel-1k-null-image-check

Conversation

@sentry

@sentry sentry Bot commented Jul 9, 2026

Copy link
Copy Markdown

The function _remove_preset_flag in src/common/history.c was susceptible to a NULL pointer dereference. The dt_image_t *image variable, obtained from dt_image_cache_get, was dereferenced without a NULL check. If dt_image_cache_get returned NULL (e.g., if the image was not found in the cache), this would lead to a segfault.

This commit adds a NULL check for the image pointer immediately after the call to dt_image_cache_get. If image is NULL, the function now returns early, preventing the crash. This aligns with existing patterns in the codebase for handling potential NULL returns from dt_image_cache_get.

Fixes ANSEL-1K

@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

0 participants