Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Modules/_xxtestfuzz/fuzzer.c
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since as the PR body says, we should add a test to trigger it and ensure that the change fixes this issue.

Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading