This repository was archived by the owner on Jan 22, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed
main/java/com/fasterxml/jackson/dataformat/cbor
test/java/com/fasterxml/jackson/dataformat/cbor Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ Project: jackson-dataformat-cbor
44=== Releases ===
55------------------------------------------------------------------------
66
7+ 2.5.6 (not released)
8+
9+ #18: Correct parsing of zero length byte strings
10+ (reported, fix suggested by philipa@github)
11+
7122.5.5 (07-Dec-2015)
8132.5.4 (09-Jun-2015)
9142.5.3 (24-Apr-2015)
Original file line number Diff line number Diff line change 1818
1919public final class CBORParser extends ParserMinimalBase
2020{
21+ private final static byte [] NO_BYTES = new byte [0 ];
22+
2123 /**
2224 * Enumeration that defines all togglable features for CBOR generators.
2325 */
@@ -1726,6 +1728,9 @@ protected byte[] _finishBytes(int len) throws IOException
17261728 {
17271729 // First, simple: non-chunked
17281730 if (len >= 0 ) {
1731+ if (len == 0 ) {
1732+ return NO_BYTES ;
1733+ }
17291734 byte [] b = new byte [len ];
17301735 if (_inputPtr >= _inputEnd ) {
17311736 loadMoreGuaranteed ();
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public Bytes() { }
2020 private final ObjectMapper MAPPER = cborMapper ();
2121
2222 public void testSmallBinaryValues () throws Exception {
23+ _testBinary (0 );
2324 _testBinary (1 );
2425 _testBinary (20 );
2526 _testBinary (100 );
You can’t perform that action at this time.
0 commit comments