增加边界检查,防止编译时报warning

This commit is contained in:
Luan-233
2023-09-21 20:40:29 -07:00
parent 1306df3963
commit 19d1f3a5ed

View File

@ -227,7 +227,7 @@ PyObject *Bytes_Format(PyObject *format, PyObject *args, char place_holder) {
} /* '%' */
} /* until end */
if (dict) { // if args' type is dict, the func ends
if (dict || (arglen < 0) || (argidx < 0)) { // args' type is dict, the func ends
if (args_owned) Py_DECREF(args);
if (!(result = resize_bytes(result, reslen - rescnt))) return NULL; // resize and return
if (place_holder != '%') {