Weave incorrectly assumes PyStrings are NUL-terminated (Trac #657) #1184
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
Migrated from Trac
Original ticket http://projects.scipy.org/scipy/ticket/657 on 2008-04-26 by trac user jonny5532, assigned to unknown.
Weave incorrectly assumes that PyStrings are NUL terminated - they infact store the length separately. As a result, all conversions to/from std::strings can be unnecessarily truncated if they contain NUL characters as they go via char* arrays.
I have fixed this locally by changing the code surrounding PyString_FromString and PyString_AsString calls which convert to/from std::strings to also note the length of the string.
The text was updated successfully, but these errors were encountered: