NVIDIA / NVIDIA/cuopt

Escape msg before embedding in JSON payload in mps_parser_throw

Open
#1,436 4 comments 0 reactions 1 assignee View on GitHub

@aliceb-nv is already working on this.

Since Jun 15, 2026.

awaiting response
Dominant language
Cuda
Stars
1k
Forks
233
Avg merge
4d 4h
Merged PRs (30d)
95

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.