mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-105375: Improve error handling in sqlite3 collation callback (#105412)
Check for error after each call to PyUnicode_FromStringAndSize().
This commit is contained in:
parent
ffd2654550
commit
a24a780d93
2 changed files with 7 additions and 3 deletions
|
@ -1868,10 +1868,12 @@ collation_callback(void *context, int text1_length, const void *text1_data,
|
|||
}
|
||||
|
||||
string1 = PyUnicode_FromStringAndSize((const char*)text1_data, text1_length);
|
||||
if (string1 == NULL) {
|
||||
goto finally;
|
||||
}
|
||||
string2 = PyUnicode_FromStringAndSize((const char*)text2_data, text2_length);
|
||||
|
||||
if (!string1 || !string2) {
|
||||
goto finally; /* failed to allocate strings */
|
||||
if (string2 == NULL) {
|
||||
goto finally;
|
||||
}
|
||||
|
||||
callback_context *ctx = (callback_context *)context;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue