Skip to content
This repository was archived by the owner on Jan 22, 2019. It is now read-only.

Commit 17a63ad

Browse files
committed
Merge branch '2.5' into 2.6
Conflicts: pom.xml release-notes/VERSION
2 parents 8766a3e + ee746dc commit 17a63ad

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

release-notes/VERSION

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Project: jackson-dataformat-cbor
44
=== Releases ===
55
------------------------------------------------------------------------
66

7+
2.6.6 (not yet released)
8+
9+
#18: Correct parsing of zero length byte strings
10+
(reported, fix suggested by philipa@github)
11+
712
2.6.5 (19-Jan-2016)
813

914
#15: CBORParser.getNumberType returns DOUBLE even if the generator has been fed with a float
@@ -24,6 +29,7 @@ No changes since 2.6.2
2429

2530
No changes since 2.5
2631

32+
2.5.5 (07-Dec-2015)
2733
2.5.4 (09-Jun-2015)
2834
2.5.3 (24-Apr-2015)
2935
2.5.2 (29-Mar-2015)

src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
public final class CBORParser extends ParserMinimalBase
1919
{
20+
private final static byte[] NO_BYTES = new byte[0];
21+
2022
/**
2123
* Enumeration that defines all togglable features for CBOR generators.
2224
*/
@@ -2078,6 +2080,9 @@ protected byte[] _finishBytes(int len) throws IOException
20782080
{
20792081
// First, simple: non-chunked
20802082
if (len >= 0) {
2083+
if (len == 0) {
2084+
return NO_BYTES;
2085+
}
20812086
byte[] b = new byte[len];
20822087
if (_inputPtr >= _inputEnd) {
20832088
loadMoreGuaranteed();

src/test/java/com/fasterxml/jackson/dataformat/cbor/ParserBinaryTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)