Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3414,6 +3414,25 @@ protected void _skipIncomplete() throws IOException
&& type != CBORConstants.MAJOR_TYPE_BYTES) {
_throwInternal();
}

// [dataformats-binary#599]: If we are in a stringref namespace, we need to
// actually read and store the string/bytes value instead of just skipping it,
// so that later string references can find it.
// The finish methods will determine if the value should be added to the
// reference table based on shouldReferenceString().
if (!_stringRefs.empty()) {
if (type == CBORConstants.MAJOR_TYPE_TEXT) {
// Need to actually read the text (which may add to stringRefs)
_finishTextToken(_typeByte);
} else {
// For bytes: decode length then read (which may add to stringRefs)
int len = _decodeExplicitLength(_typeByte & 0x1F);
_finishBytes(len);
}
return;
}

// Standard skip logic when not in stringref namespace
final int lowBits = _typeByte & 0x1F;
if (lowBits <= 23) {
if (lowBits > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.fasterxml.jackson.dataformat.cbor.tofix;
package com.fasterxml.jackson.dataformat.cbor;

import java.util.Arrays;

import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.ObjectMapper;

import com.fasterxml.jackson.dataformat.cbor.*;
import com.fasterxml.jackson.dataformat.cbor.testutil.failure.JacksonTestFailureExpected;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;
Expand All @@ -27,7 +24,6 @@ public void testDupsNoStringRef() throws Exception
}

// [dataformats-binary#599]
@JacksonTestFailureExpected
@Test
public void testDupsWithStringRef() throws Exception
{
Expand Down
4 changes: 4 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -422,3 +422,7 @@ Vincent Eigenberger (@beseder1)
* Contributed fix for #601: Jackson subtype Avro schema unions are non-deterministic
and therefore incompatible with each other
(2.20.1)

Yohei Kishimoto (@morokosi)
* Reported #599: (cbor) Unable to deserialize stringref-enabled CBOR with ignored properties
(2.21.0)
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Active maintainers:

2.21.0 (not yet released)

#599: (cbor) Unable to deserialize stringref-enabled CBOR with ignored properties
(reported by Yohei K)
#623: (ion) Upgrade `ion-java` dep to 1.11.11 (from 1.11.10)
(requested by @Shaurya0108)

Expand Down