bpo-40998: Address compiler warnings found by ubsan (GH-20929)
Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran
This commit is contained in:
@@ -839,7 +839,11 @@ xmlcharrefreplace(_PyBytesWriter *writer, char *str,
|
||||
|
||||
/* generate replacement */
|
||||
for (i = collstart; i < collend; ++i) {
|
||||
str += sprintf(str, "&#%d;", PyUnicode_READ(kind, data, i));
|
||||
size = sprintf(str, "&#%d;", PyUnicode_READ(kind, data, i));
|
||||
if (size < 0) {
|
||||
return NULL;
|
||||
}
|
||||
str += size;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user