-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sqlite3] Do not truncate results of user functions and aggregates on the first NUL #88985
Comments
The third argument to sqlite3_result_text() is the length of the string passed as the second argument. Currently, we pass -1, so SQLite has to invoke strlen() to compute the length of the passed string. Suggesting to use PyUnicode_AsUTF8AndSize() iso. PyUnicode_AsUTF8() and pass the string size to avoid the superfluous strlen(). See also: |
The difference between specifying negative and non-negative third argument of sqlite3_result_text() is that in the latter case the result can contain embedded NUL characters. Could you please add a test for string containing embedded NUL? Letting SQLite compute string length would work incorrect in case of embedded NULs, so I think that we should raise explicit error if sz > INT_MAX. |
Of course, thanks for the heads up.
Yes, I thought about this. I do agree that raising OverflowError would be better. Thanks. |
Serhiy, I've updated the PR, if you want to take a look. Thanks for your feedback. |
Thanks, Serhiy! |
str
s with embedded NULL chars returned bysqlite3
UDF callbacks #27588str
s with embedded NULL chars returned bysqlite3
UDF callbacks (GH-27588) #27611str
s with embedded NULL chars returned bysqlite3
UDF callbacks (GH-27588) #27639Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: