Smile: invalid UTF-8 sequences (overlong, surrogates, > U+10FFFF, bad continuation bytes) not rejected in text
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
Start with the listed UTF-8 decoders in SmileParser and NonBlockingByteArrayParser, then check SmileConstants.sUtf8UnitLengths and the related tests for blocking, non-blocking, short, long, value, and name paths. Verify rejection of the invalid sequences described in the issue, including split input and continuation-byte errors; done when all affected paths reject them and error offsets and byte values are reported correctly.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
SmileParser and NonBlockingByteArrayParser accept several invalid UTF-8 sequences in Unicode String values and property names and decode 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, with a "tiny Unicode" value: header, 0x80 + (len - 2), 'a' + sequence + 'b'.
byte[] doc = {':', ')', '\n', 0x00, (byte) 0x82, 'a', (byte) 0xC0, (byte) 0xAF, 'b'};
JsonParser p = new SmileFactory().createParser(doc);
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 first five rows apply to every path: blocking and non-blocking parsers, short and long values, short and long names.
The missing-continuation rows apply to the short ("tiny"/"short" Unicode) value and name paths in both parsers. The non-blocking parser also accepts them in medium-length (~100 byte) names. The long value paths reject them.
Affected code:
SmileParser:_decodeShortUnicodeValue(),_decodeShortUnicodeName(),_decodeLongUnicodeName(), the long-Unicode text decoders and_decodeUtf8_3()/_decodeUtf8_4()NonBlockingByteArrayParser:_decodeUTF8_2()/_3()/_4(), the short Unicode value/name decoders and the split-input path for partially read code pointsSmileConstants.sUtf8UnitLengthsmaps0xC0/0xC1and0xF5-0xF7to valid lengths
Suggested fix: 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. Also check continuation bytes in the short decoders.
Smaller issues in error messages:
- for an invalid lead byte in a short value, the reported byte offset is the end of the string, not the bad byte
_decodeLongUnicodeName()passes the unmasked byte to_reportInvalidOther(), so the message shows a sign-extended value such asInvalid UTF-8 middle byte 0xffffc341
- Lingua principale
- Java
- Stelle
- 348
- Fork
- 159
- Merge medio
- 18h 2m
- PR unite (30g)
- 31
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di FasterXML/jackson-dataformats-binary
-
protobuf
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
FasterXML/jackson-dataformats-binary#874 ·
I maintainer di solito rispondono entro 1 giorno
-
smile
Difficoltà 3/5 1-2 giorni Idoneità per principianti 71/100
FasterXML/jackson-dataformats-binary#869 ·
I maintainer di solito rispondono entro 1 giorno
-
cbor
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
FasterXML/jackson-dataformats-binary#868 ·
I maintainer di solito rispondono entro 1 giorno
-
protobuf
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
FasterXML/jackson-dataformats-binary#863 ·
I maintainer di solito rispondono entro 1 giorno
-
avro
Difficoltà 4/5 3-5 giorni Idoneità per principianti 57/100
FasterXML/jackson-dataformats-binary#862 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di FasterXML/jackson-dataformats-binary
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
geonetwork/core-geonetwork#9592 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] ServerHttpRequest.getURI() throws NumberFormatException when Host contains an explicit portApertacomponent/need-triage type/need-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
apache/rocketmq-dashboard#7361 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
higress-group/himarket#358 ·