Commit 13af0f4
committed
Only read bytes required to complete CBOR string
In CBOR a string data item's initial byte encodes the string's length in number of bytes and not code points and the string is always encoded using UTF-8.
Thus, the following comment in the code doesn't really apply, as surrogate pairs is a UTF-16 thing and the string's length has been provided in number of bytes anyway.
```
// 29-Jan-2021, tatu: as per [dataformats-binary#238] must keep in mind that
// the longest individual unit is 4 bytes (surrogate pair) so we
// actually need len+3 bytes to avoid bounds checks
```1 parent 3eb1d43 commit 13af0f4
File tree
1 file changed
+6
-14
lines changed- cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor
1 file changed
+6
-14
lines changedLines changed: 6 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2281 | 2281 | | |
2282 | 2282 | | |
2283 | 2283 | | |
2284 | | - | |
2285 | | - | |
2286 | | - | |
2287 | 2284 | | |
2288 | 2285 | | |
2289 | | - | |
2290 | 2286 | | |
2291 | 2287 | | |
2292 | | - | |
| 2288 | + | |
2293 | 2289 | | |
2294 | | - | |
2295 | | - | |
| 2290 | + | |
| 2291 | + | |
2296 | 2292 | | |
2297 | 2293 | | |
2298 | 2294 | | |
| |||
2326 | 2322 | | |
2327 | 2323 | | |
2328 | 2324 | | |
2329 | | - | |
2330 | | - | |
2331 | | - | |
2332 | 2325 | | |
2333 | 2326 | | |
2334 | 2327 | | |
2335 | 2328 | | |
2336 | 2329 | | |
2337 | 2330 | | |
2338 | | - | |
2339 | 2331 | | |
2340 | 2332 | | |
2341 | | - | |
| 2333 | + | |
2342 | 2334 | | |
2343 | | - | |
2344 | | - | |
| 2335 | + | |
| 2336 | + | |
2345 | 2337 | | |
2346 | 2338 | | |
2347 | 2339 | | |
| |||
0 commit comments