OpenPrinting / OpenPrinting/fuzzing

API misuse in fuzz_ppd_gen_conflicts.c: cupsGetConflicts return value ignored

Open Beginner friendly
#45 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
8
Forks
18
Avg merge
7h 37m
Merged PRs (30d)
1

Description

Summary

The fuzzer fuzz_ppd_gen_conflicts.c incorrectly uses the cupsGetConflicts API by ignoring its return value, causing mismatched option count and pointer state when calling cupsResolveConflicts.

Problem

Line 38 ignores the return value:

cupsGetConflicts(ppd, "SampleOption", "SampleChoice", &options);  // ❌ Return value ignored

cupsGetConflicts modifies *options and returns the new count, but the fuzzer continues using the old num_options value from line 31.

Consequence

  • Passes mismatched num_options and *options to cupsResolveConflicts
  • Before upstream fix (5b5f5c0d6): NULL pointer dereference crash
  • After fix: Logic errors, cannot properly test conflict resolution

Correct Usage

From cups/testppd.c:

num_options = cupsGetConflicts(ppd, "InputSlot", "Envelope", &options);

Should capture and use the return value.

Reference

As noted by @michaelrsweet in GHSA-r4j5-9gvw-5h7q:

"your PoC code uses the cupsGetConflicts API incorrectly - it returns the number of conflicting options, but you are ignoring the return value."


This prevents proper fuzzing of CUPS conflict resolution logic.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in fuzz_ppd_gen_conflicts.c at line 38 and compare the API usage with the example in cups/testppd.c. Verify that the conflict count and options pointer remain consistent when cupsResolveConflicts is called, then exercise the fuzz target to confirm conflict resolution is tested without the reported mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
testing-qa
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.