Skip to content

CBOR-to-JSON: validate UTF-8 content is correct - #332

Open
thiagomacieira wants to merge 2 commits into
intel:mainfrom
thiagomacieira:CBOR_to_JSON_validate_UTF_8_content_is_correct
Open

CBOR-to-JSON: validate UTF-8 content is correct#332
thiagomacieira wants to merge 2 commits into
intel:mainfrom
thiagomacieira:CBOR_to_JSON_validate_UTF_8_content_is_correct

Conversation

@thiagomacieira

Copy link
Copy Markdown
Member

We were passing through anything that wasn't a control character, so invalid CBOR text strings were passed through to invalid JSON.

As we have the get_utf8() function for cborvalidation.c, let's use it to validate here too.

Fixes #331.

If `escape_text_string()` fails in `stringify_map_key()`, we would have
returned without freeing the contents, but `map_to_json()` doesn't free
it on error.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
We were passing through anything that wasn't a control character, so
invalid CBOR text strings were passed through to invalid JSON.

As we have the get_utf8() function for cborvalidation.c, let's use it to
validate here too.

Fixes intel#331.

Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
@thiagomacieira
thiagomacieira force-pushed the CBOR_to_JSON_validate_UTF_8_content_is_correct branch from aa66624 to c6834ff Compare August 4, 2026 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cbor_value_to_json_advance() does not perform the documented UTF-8 validation

1 participant