Skip to content

Short NUL-only keys incorrectly detected as duplicates in CBOR and SMILE #312

Closed
@DaveCTurner

Description

@DaveCTurner

The following object apparently cannot be deserialised in CBOR and SMILE:

{"\u0000":"","\u0000\u0000":""}

The following are base64-encoded copies of its representation in various formats:

JSON: eyJcdTAwMDAiOiIiLCJcdTAwMDBcdTAwMDAiOiIifQ==
YAML: LS0tCiJcMCI6ICIiCiJcMFwwIjogIiIK
SMILE: OikKBfqAACCBAAAg+w==
CBOR: v2EAYGIAAGD/

As far as I can tell these all look correct, but on deserialization the field names are reported as duplicates:

com.fasterxml.jackson.core.JsonParseException: Duplicate field '�'
 at [Source: (byte[])":)
���� ��� �"; line: -1, column: 11]

	at __randomizedtesting.SeedInfo.seed([29F6747C61080477:49491DCB06A6B558]:0)
	at com.fasterxml.jackson.core.json.JsonReadContext._checkDup(JsonReadContext.java:204)
	at com.fasterxml.jackson.core.json.JsonReadContext.setCurrentName(JsonReadContext.java:198)
	at com.fasterxml.jackson.dataformat.smile.SmileParser._handleFieldName(SmileParser.java:1346)
	at com.fasterxml.jackson.dataformat.smile.SmileParser.nextToken(SmileParser.java:374)
	at com.fasterxml.jackson.core.JsonGenerator._copyCurrentContents(JsonGenerator.java:1935)
	at com.fasterxml.jackson.core.JsonGenerator.copyCurrentStructure(JsonGenerator.java:1914)
	at org.elasticsearch.xcontent.json.JsonXContentGenerator.copyCurrentStructure(JsonXContentGenerator.java:396)

Relates elastic/elasticsearch#84146

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.14cborhas-failing-testIndicates that there exists a test case (under `failing/`) to reproduce the issuesmile

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions