Skip to content

[APIs] Bound the length of strings passed to and returned by Uno - #1079

Open
cvanaret wants to merge 4 commits into
mainfrom
string_length
Open

cvanaret wants to merge 4 commits into
mainfrom
string_length

Conversation

@cvanaret

@cvanaret cvanaret commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Strings passed to and returned by Uno are now limited to UNO_MAX_STRING_LENGTH (4095) characters in every interface, and strings with an embedded null character are rejected.

  • Core: Options rejects string values that are too long or contain \0, covering C, Fortran, Julia, Python, AMPL and option files. Error messages no longer echo long strings in full.
  • C API: every input string is read with a bounded memchr (at most 4096 bytes), every returned string fits within the limit, and UNO_MAX_STRING_LENGTH is an enumerator, so it can size a buffer in C.
  • Fortran: the wrappers reject a c_null_char in the middle of a string, accept a single trailing one, and read returned strings with a bounded scan. The fix is in the generator.
  • Julia, Python: they check the model name and expose the new constant.

cc @amontoison

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant