Repository navigation
cd-icc: set an error when a description/text tag is present but empty - #209
Merged
Merged
Conversation
cd_icc_get_mluc_data() returned NULL without setting the GError on the two cmsMLUgetWide() == 0 paths -- a text tag that exists but holds a zero-length string. Callers assume a NULL return implies the error is set, so this NULL-with-no-error can be dereferenced: in the daemon, cd_main_daemon_method_call() reads error->message after a failed CreateProfileWithFd and crashes with SIGSEGV (reachable over D-Bus, e.g. when a display's profile is registered at login). Set CD_ICC_ERROR_NO_DATA on these paths, mirroring the existing tag-missing branch just above, so the function never returns NULL with the error unset. Fixes the description/copyright/manufacturer/model getters and the resulting daemon crash.
Add /colord/icc{empty-desc}, backed by empty-desc.icc: a normal sRGB
profile whose 'desc' mluc record has a zero-length string. The test
asserts cd_icc_get_description() returns NULL with CD_ICC_ERROR_NO_DATA
rather than NULL with no GError set. It fails before the previous commit
and passes after it.
hughsie
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cd_icc_get_mluc_data()can returnNULLwithout setting theGErrorwhen a profile's text tag (e.g.desc) exists but contains a zero-length string. Callers assume "NULL return ⇒ error set", so this leads to aNULL-pointer dereference — and in the daemon, a crash.Root cause
In
lib/colord/cd-icc.c, the twocmsMLUgetWide() == 0paths jump toout:(which doesreturn value;withvaluestillNULL) without callingg_set_error*. The sibling "tag missing" branch just above already setsCD_ICC_ERROR_NO_DATA, so these two paths were simply missing the same treatment.This propagates through:
With
error == NULL,error->messagedereferences offset 8 of a NULL pointer → SIGSEGV. This is reachable over D-Bus viaCreateProfile/CreateProfileWithFdwhenever a client (e.g. gnome-settings-daemon / mutter registering a display) loads such a profile, so in practice it crashescolordon every login for affected users, leaving Settings → Color empty. (Several existing "colormgr get-devices is empty" reports share this symptom.)The malformed profiles seen in the wild have a
descmluctag with a singleenUSrecord of length 0 — something lcms tolerates on read but never writes itself.Fix
Set
CD_ICC_ERROR_NO_DATAon the empty-text paths, mirroring the existing tag-missing branch, so the function never returnsNULLwith the error unset. This fixes all four MLU getters (description/copyright/manufacturer/model) and, transitively, the daemon crash.Test
Adds
/colord/icc{empty-desc}tocd-test-private.cwith a small fixture (data/tests/empty-desc.icc: a normal sRGB profile whosedescmlucrecord length is forced to 0). It assertscd_icc_get_description()returnsNULLwithCD_ICC_ERROR_NO_DATA. The test fails againstmasterand passes with this change.Verification
colord-test-privatesuite passes (no regressions).cd_main_daemon_method_callonCreateProfileWithFd; the patched daemon survives, loggingCdMain: failed to profile from fd: cmsSigProfile*Tag is emptyand returning a proper D-Bus error.