GzipReader's encoding conversion behaves differently from IO
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
This reports encoding-conversion mismatches between Zlib::GzipReader and IO, with three reproducible examples in the issue body. Start by finding where GzipReader applies external_encoding/internal_encoding in the C extension (ext/zlib/zlib.c) and compare with how io.c handles conversion errors and the gets limit. Note the maintainer is unsure whether fixing is desirable due to compatibility concerns, so the first step is discussing intended behavior before any patch; 'done' is a maintainer decision plus, if agreed, matching IO semantics with tests covering the three cases.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When external_encoding/internal_encoding are given, Zlib::GzipReader converts the data differently from IO in a few ways. Fixing them could be incompatible, so I'm not sure whether they are worth fixing. I'm opening this issue for now.
-
A conversion error is ignored, and the data is returned as is.
# "a" in UTF-16BE followed by one extra byte gz = Zlib.gzip("\x00a\x00".b) o = {external_encoding: "UTF-16BE", internal_encoding: "UTF-8"} Zlib::GzipReader.new(StringIO.new(gz), **o).read #=> "\x00a\x00" (not converted) # IO#read raises Encoding::InvalidByteSequenceErrorWith a dummy encoding such as UTF-16 (with BOM),
getcreturns""and the extra byte is lost:gz = Zlib.gzip("\xFE\xFF\x00a\x00".b) o = {external_encoding: "UTF-16", internal_encoding: "UTF-8"} g = Zlib::GzipReader.new(StringIO.new(gz), **o) 3.times.map { g.getc } #=> ["a", "", nil] -
The limit of
getsis counted in bytes before conversion, while IO counts it after conversion.s = ("\x82\xa0" * 3 + "\n").b # "あああ\n" in Shift_JIS o = {external_encoding: "Shift_JIS", internal_encoding: "UTF-8"} Zlib::GzipReader.new(StringIO.new(Zlib.gzip(s)), **o).gets(3) #=> "ああ" # File#gets(3) with the same options returns "あ"
- Ngôn ngữ chính
- C
- Star
- 73
- Fork
- 43
- Merge trung bình
- 4 ngày 18 phút
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ruby/zlib
-
`Zlib::Deflate#params` segfaults when called before any output buffer existsCó thể đã có người làm @SAY-5 đã nhận 85 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 2 ngày
-
GzipReader: gets sometimes returns incomplete multi-byte charactersCó thể đã có người làm @segiddins đã nhận 22 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 2 ngày
-
GzipReader: internal_encoding option overwrites external_encodingCó thể đã có người làm @segiddins đã nhận 22 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
HTTP Request Smuggling: non-final chunked Transfer-Encoding not rejected (CWE-444)Có thể đã có người làm @code1a2024 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
jaredgei/wow-forever-android#97 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
on_ctrl_redirect(): iterator never advances — infinite loop stalls the event loop at 100% CPUĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
openziti/ziti-sdk-c#1254 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Requisite=graphical-session.target lets a D-Bus activation at logout cancel the target's stopĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
flatpak/xdg-desktop-portal#2215 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
http_fetch tests: the two no-child rows fail, not skip, where a task's children file does not existCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởarea:http kind:gate-defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
InauguralSystems/EigenScript#2397 ·
Maintainer thường phản hồi trong vòng 1 ngày