summaryrefslogtreecommitdiff
path: root/Modules/pyexpat.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/pyexpat.c')
-rw-r--r--Modules/pyexpat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 7a26fe24e7..ad8148adae 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -745,6 +745,8 @@ pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls,
slen = view.len;
}
+ static_assert(MAX_CHUNK_SIZE <= INT_MAX,
+ "MAX_CHUNK_SIZE is larger than INT_MAX");
while (slen > MAX_CHUNK_SIZE) {
rc = XML_Parse(self->itself, s, MAX_CHUNK_SIZE, 0);
if (!rc)
@@ -752,7 +754,7 @@ pyexpat_xmlparser_Parse_impl(xmlparseobject *self, PyTypeObject *cls,
s += MAX_CHUNK_SIZE;
slen -= MAX_CHUNK_SIZE;
}
- Py_BUILD_ASSERT(MAX_CHUNK_SIZE <= INT_MAX);
+
assert(slen <= INT_MAX);
rc = XML_Parse(self->itself, s, (int)slen, isfinal);