Skip to content

Escape msg before embedding in JSON payload in mps_parser_throw #1436

@coderabbitai

Description

@coderabbitai

Summary

mps_parser_throw() (in cpp/src/io/utilities/error.hpp) concatenates msg verbatim into a JSON string. A token, file path, or system error message containing ", \, or a newline will produce malformed JSON and break any downstream consumer expecting the MPS_PARSER_ERROR_TYPE / msg structure.

Suggested fix

Add a small json_escape(const std::string&) helper that replaces \, ", \n, \r, and \t with their JSON-escaped forms, and apply it when constructing the thrown std::logic_error message in mps_parser_throw.

References

Metadata

Metadata

Assignees

Labels

awaiting responseThis expects a response from maintainer or contributor depending on who requested in last comment.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions