`get_options()` repeats the first byte when hex-encoding octet strings
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 85/100
Research direction
In scheduler/job.c, inspect the hexadecimal output loop in get_options() and compare how the neighboring quoted-string branch advances its input pointer. Change the loop so it emits two hexadecimal digits for each input byte in order; done when 41 0A 42 encodes as 410A42 instead of 414141. The issue does not name a test, so look for an existing test that exercises print filter option encoding.
Written by the indexing model from the issue text.
Description
In scheduler/job.c, the hexadecimal branch of get_options() advances the output pointer but not the input pointer. Each iteration formats *valptr, so a multi-byte octet string that takes this branch is serialized as repetitions of its first byte. Print filters receive a different value from the one supplied.
Expected: Emit two hexadecimal digits for each input byte, in order.
Actual: The first byte is emitted once per input byte. For example, at the encoder level, 41 0A 42 should become <410A42> but the loop produces <414141>. This example is derived from the loop, not an end-to-end print test.
Suggested fix: Advance valptr once per iteration in the hex output loop, as the neighboring quoted-string branch already does.
The hex output loop was introduced in commit 5483fd294, which addressed Apple CUPS issue #5558. That issue concerned handling length-delimited octet strings, not this repeated-byte defect. The later octet-string scan fix advances the pointer while deciding whether to hex-encode, but does not change the hex output loop.
- Dominant language
- C
- Stars
- 1.8k
- Forks
- 367
- Avg merge
- 12h 18m
- Merged PRs (30d)
- 5
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from OpenPrinting/cups
-
cupsd crashes in _ppdCreateFromIPP2() when a printer reports a media size with no PPD name (e.g. jpn_chou2)Possibly taken @michaelrsweet claimed this 3 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OpenPrinting/cups#1828 · 8 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
NULL pointer dereference in `print_job()` during MIME auto-detectionPossibly taken @michaelrsweet claimed this 3 days ago. Opennot a bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenPrinting/cups#1826 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
OAuth (bearer) quota check denies every user when the allowed-user list is emptyPossibly taken @RonitMehta08 claimed this 7 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
OpenPrinting/cups#1795 · 1 comment ·
Maintainers usually reply within 1 day
-
cupsdGetPrivateAttrs: @ACL never grants access, and @OWNER is looked up as an operating-system group for non-ownersPossibly taken @user-Param claimed this 14 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
OpenPrinting/cups#1796 ·
Maintainers usually reply within 1 day
-
OAuth/OIDC token-validation gaps: nonce not enforced when absent, at_hash alg, inbound bearer not signature/aud/exp-validated + unverified email used for authzMay be free again @michaelrsweet claimed this 152 days ago, and no pull request is open. Openinvestigating
OpenPrinting/cups#1609 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in OpenPrinting/cups
Similar issues
-
bug severity: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AlessandroSangiuliano/Uros#1014 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
OpenXiangShan/NEMU#1314 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
micropython/micropython#20020 ·
Maintainers usually reply within 1 day
-
macro typo in readmeOpen
Difficulty 1/5 Under an hour Newbie friendliness 88/100