CBOR: invalid UTF-8 sequences (overlong, surrogates, > U+10FFFF) 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 CBORConstants.sUtf8UnitLengths and the short and long text decoders named in the issue, including the chunked variants and property-name decoder. Compare their validation against RFC 3629 and the listed reproductions; cover byte-array and InputStream input, short and long text, chunked strings, and property names. Done means invalid sequences are rejected consistently, including invalid continuation bytes, and the byte offset points to the bad lead byte.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
CBORParser accepts several invalid UTF-8 sequences in text values and property names 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. Each case is a definite-length text string: 'a' + sequence + 'b'.
byte[] doc = {0x64, 'a', (byte) 0xC0, (byte) 0xAF, 'b'};
JsonParser p = new CBORFactory().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 |
F0 41 41 41 (missing continuation bytes) |
ᅣ\uDC41, but only for strings that fit in the input buffer; the long-text path rejects it |
This happens for byte[] and InputStream input, short and long strings, chunked (indefinite-length) strings and property names.
Affected code:
_finishShortText(): case 3 (4-byte) doesn't check continuation bytes (// TODO - validate these too?)- the short property-name decoder (around
_finishShortTextfor names): the same _decodeUTF8_3(),_decodeUTF8_4(),_decodeChunkedUTF8_3(),_decodeChunkedUTF8_4()CBORConstants.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 4-byte short-text case.
A smaller issue: for an invalid lead byte in a short string, the reported byte offset is the end of the string, not the bad byte. _inputPtr is advanced by len before the decode loop. Example: {0x63, 'a', 0x80, 'b'} reports byte offset: #4.
- Lingua principale
- Java
- Stelle
- 348
- Fork
- 159
- Merge medio
- 22h 34m
- PR unite (30g)
- 39
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
-
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
-
smile
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
FasterXML/jackson-dataformats-binary#861 ·
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 76/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/rocketmq-dashboard#7302 ·
I maintainer di solito rispondono entro 3 giorni
-
area: android good first issue help wanted testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Gautam-aman/ResQNet#56 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation hermes-queue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
chrisalunlloyd2-sudo/mindpalace#294 ·
I maintainer di solito rispondono entro 1 giorno
-
better night vision compatAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
QuicksilverMC/Argentum#31 ·