This repository was archived by the owner on Jan 22, 2019. It is now read-only.
File tree 3 files changed +11
-0
lines changed
main/java/com/fasterxml/jackson/dataformat/cbor
test/java/com/fasterxml/jackson/dataformat/cbor
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
4
4
=== Releases ===
5
5
------------------------------------------------------------------------
6
6
7
+ 2.5.6 (not released)
8
+
9
+ #18: Correct parsing of zero length byte strings
10
+ (reported, fix suggested by philipa@github)
11
+
7
12
2.5.5 (07-Dec-2015)
8
13
2.5.4 (09-Jun-2015)
9
14
2.5.3 (24-Apr-2015)
Original file line number Diff line number Diff line change 18
18
19
19
public final class CBORParser extends ParserMinimalBase
20
20
{
21
+ private final static byte [] NO_BYTES = new byte [0 ];
22
+
21
23
/**
22
24
* Enumeration that defines all togglable features for CBOR generators.
23
25
*/
@@ -1726,6 +1728,9 @@ protected byte[] _finishBytes(int len) throws IOException
1726
1728
{
1727
1729
// First, simple: non-chunked
1728
1730
if (len >= 0 ) {
1731
+ if (len == 0 ) {
1732
+ return NO_BYTES ;
1733
+ }
1729
1734
byte [] b = new byte [len ];
1730
1735
if (_inputPtr >= _inputEnd ) {
1731
1736
loadMoreGuaranteed ();
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ public Bytes() { }
20
20
private final ObjectMapper MAPPER = cborMapper ();
21
21
22
22
public void testSmallBinaryValues () throws Exception {
23
+ _testBinary (0 );
23
24
_testBinary (1 );
24
25
_testBinary (20 );
25
26
_testBinary (100 );
You can’t perform that action at this time.
0 commit comments