Protobuf: invalid UTF-8 sequences (overlong, surrogates, > U+10FFFF, bad continuation bytes) not rejected in strings
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 56/100
Línea de trabajo
Read the affected methods _finishShortText(), _finishLongText(), _decodeUTF8_3(), and _decodeUTF8_4(), along with ProtobufUtil.sUtf8UnitLengths. Start by reproducing the listed invalid byte sequences and checking how short and long text paths differ. Done means all listed invalid sequences are rejected in both applicable paths, with regression tests covering the cases.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
ProtobufParser accepts several invalid UTF-8 sequences in string fields and decodes them into characters. RFC 3629 makes these sequences invalid.
Same class of bug as FasterXML/jackson-core#1782 and FasterXML/jackson-dataformats-text#763.
Reproduced on 2.x:
ProtobufMapper mapper = new ProtobufMapper();
ProtobufSchema schema = ProtobufSchemaLoader.std.parse("message M { optional string s = 1; }");
// field 1, length 4, 'a' C0 AF 'b'
byte[] doc = {0x0A, 0x04, 'a', (byte) 0xC0, (byte) 0xAF, 'b'};
JsonParser p = mapper.getFactory().createParser(doc);
p.setSchema(schema);
p.nextToken(); p.nextToken(); p.nextToken();
p.getText(); // -> "a/b"
| Bytes | Result |
|---|---|
C0 AF, E0 80 AF (overlong) |
/ |
F0 80 80 AF (overlong 4-byte) |
\uDC2F |
ED A0 80 (encoded surrogate) |
lone \uD800 |
F4 90 80 80 (above U+10FFFF) |
\uDC00\uDC00 |
F5 80 80 80 (lead byte F5-F7) |
\uDCC0\uDC00 |
C3 41, E2 41 41, F0 41 41 41 (missing continuation bytes) |
Á, ⁁, ᅣ\uDC41 |
The missing-continuation rows apply to strings that fit in the input buffer (_finishShortText()). The long-text path rejects them. The other rows apply to both.
Affected code: _finishShortText(), _finishLongText(), _decodeUTF8_3(), _decodeUTF8_4(). ProtobufUtil.sUtf8UnitLengths maps 0xC0/0xC1 and 0xF5-0xF7 to valid lengths.
Suggested fix: check continuation bytes in _finishShortText(). After decoding, check minimum values of 0x80, 0x800 and 0x10000 for 2-, 3- and 4-byte sequences, a maximum of 0x10FFFF, and reject 0xD800-0xDFFF.
Smaller issue in error messages: in the short path an invalid lead byte is reported as Invalid byte 80 in Unicode text block (no 0x), at the end-of-string offset rather than at the bad byte.
- Lenguaje dominante
- Java
- Estrellas
- 348
- Forks
- 159
- Merge medio
- 22 h 34 min
- PR fusionados (30 d)
- 39
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 FasterXML/jackson-dataformats-binary
-
smile
Dificultad 3/5 1-2 días Aptitud para principiantes 71/100
FasterXML/jackson-dataformats-binary#869 ·
Los mantenedores suelen responder en 1 día
-
cbor
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
FasterXML/jackson-dataformats-binary#868 ·
Los mantenedores suelen responder en 1 día
-
avro
Dificultad 4/5 3-5 días Aptitud para principiantes 57/100
FasterXML/jackson-dataformats-binary#862 ·
Los mantenedores suelen responder en 1 día
-
smile
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
FasterXML/jackson-dataformats-binary#861 ·
Los mantenedores suelen responder en 1 día
-
cbor
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
FasterXML/jackson-dataformats-binary#860 ·
Los mantenedores suelen responder en 1 día
Todos los issues de FasterXML/jackson-dataformats-binary
Issues similares
-
[Bug] DefaultSerializationExceptionWrapper does not implement Cleanable, so cleanup() is never invoked by codecsPosiblemente ocupada @binbin0325 la tomó hoy. Abiertocomponent/need-triage type/need-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
2026 Error Report
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
triplea-game/triplea#15096 ·
Los mantenedores suelen responder en 1 día
-
[Bug][API] Switching workflow versions leaves schedules onlinePosiblemente ocupada @zhuangchong la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/dolphinscheduler#18731 ·
Los mantenedores suelen responder en 1 día
-
Implement JDBC Domain Enums (`SqlCategory`, `SqlExecutionStatus`, `SqlExecutionType`) in Core ModuleAbiertocore-module enhancement good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 87/100
sdlc-pro/spring-lens#531 ·
Los mantenedores suelen responder en 1 día