`get_options()` repeats the first byte when hex-encoding octet strings

未关闭 适合新手
#1,830 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@rue19 已经在做这个了。

开始于 2026年11月26日。

  • #1831 来自 @rue19 —— 未关闭

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
85/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c
领域
backend

调研方向

在 scheduler/job.c 中检查 get_options() 里的十六进制输出循环,并比较相邻的带引号字符串分支如何推进输入指针。修改循环,使其按顺序为每个输入字节输出两位十六进制数字;当 41 0A 42 编码为 410A42 而不是 414141 时,即为完成。Issue 没有指定测试,因此请查找一个现有测试,用于验证打印过滤器选项的编码。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
C
星标
1.8k
派生
367
平均合并
12 小时 18 分钟
30 天内合并 PR
5

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

OpenPrinting/cups 的其他 Issue

查看 OpenPrinting/cups 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。