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

Đang mở Phù hợp với người mới
#1,830 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@rue19 đang làm issue này rồi.

Từ ngày 26/11/2026.

  • #1831 của @rue19 — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c
Lĩnh vực
backend

Hướng nghiên cứu

Trong scheduler/job.c, kiểm tra vòng lặp xuất hệ thập lục phân trong get_options() và so sánh cách nhánh chuỗi có dấu ngoặc kép liền kề tăng con trỏ đầu vào. Thay đổi vòng lặp để nó xuất hai chữ số thập lục phân cho mỗi byte đầu vào theo đúng thứ tự; hoàn tất khi 41 0A 42 được mã hóa thành 410A42 thay vì 414141. Issue không nêu tên bài kiểm thử, vì vậy hãy tìm một bài kiểm thử hiện có kiểm tra việc mã hóa tùy chọn của bộ lọc in.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
C
Star
1.8k
Fork
367
Merge trung bình
12 giờ 18 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của OpenPrinting/cups

Tất cả issue của OpenPrinting/cups

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.