From c46665723f6257114e640521883110c14a407d19 Mon Sep 17 00:00:00 2001 From: Shivam7-1 <55046031+Shivam7-1@users.noreply.github.com> Date: Mon, 30 Dec 2024 11:01:00 +0530 Subject: [PATCH] Update fuzzer.c --- Modules/_xxtestfuzz/fuzzer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Modules/_xxtestfuzz/fuzzer.c b/Modules/_xxtestfuzz/fuzzer.c index a04f1412eefda1..7eeee0b19af3ae 100644 --- a/Modules/_xxtestfuzz/fuzzer.c +++ b/Modules/_xxtestfuzz/fuzzer.c @@ -56,13 +56,11 @@ static int fuzz_builtin_int(const char* data, size_t size) { base = -base; } - PyObject* s = PyUnicode_FromStringAndSize(data, size); + PyObject* s = PyUnicode_DecodeUTF8(data, size, "replace"); if (s == NULL) { - if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) { - PyErr_Clear(); - } return 0; } + PyObject* l = PyLong_FromUnicodeObject(s, base); if (l == NULL && PyErr_ExceptionMatches(PyExc_ValueError)) { PyErr_Clear();