GzipReader's encoding conversion behaves differently from IO
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 25/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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 "あ"
- Lenguaje dominante
- C
- Estrellas
- 73
- Forks
- 43
- Merge medio
- 4 d 18 min
- PR fusionados (30 d)
- 12
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ruby/zlib
-
`Zlib::Deflate#params` segfaults when called before any output buffer existsPosiblemente ocupada @SAY-5 la tomó hace 85 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
ruby/zlib#135 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
GzipReader: gets sometimes returns incomplete multi-byte charactersPosiblemente ocupada @segiddins la tomó hace 22 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 2 días
-
GzipReader: internal_encoding option overwrites external_encodingPosiblemente ocupada @segiddins la tomó hace 22 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
Los mantenedores suelen responder en 2 días
Issues similares
-
HTTP Request Smuggling: non-final chunked Transfer-Encoding not rejected (CWE-444)Posiblemente ocupada @code1a2024 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
jaredgei/wow-forever-android#97 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
on_ctrl_redirect(): iterator never advances — infinite loop stalls the event loop at 100% CPUAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
openziti/ziti-sdk-c#1254 ·
Los mantenedores suelen responder en 1 día
-
Requisite=graphical-session.target lets a D-Bus activation at logout cancel the target's stopAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
flatpak/xdg-desktop-portal#2215 ·
Los mantenedores suelen responder en 2 días
-
http_fetch tests: the two no-child rows fail, not skip, where a task's children file does not existPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea:http kind:gate-defect
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
InauguralSystems/EigenScript#2397 ·
Los mantenedores suelen responder en 1 día