]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104051: fix crash in test_xxtestfuzz with -We (#104052)
authorIrit Katriel <1055913+iritkatriel@users.noreply.github.com>
Fri, 5 May 2023 10:34:13 +0000 (11:34 +0100)
committerGitHub <noreply@github.com>
Fri, 5 May 2023 10:34:13 +0000 (11:34 +0100)
Modules/_xxtestfuzz/fuzzer.c

index fb0c191d2c494d95d3561fb42f41bd2daa4f4b2a..37d402824853f0b6733112c15fb9de4ad872e77b 100644 (file)
@@ -526,13 +526,20 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
 #if !defined(_Py_FUZZ_ONE) || defined(_Py_FUZZ_fuzz_sre_compile)
     static int SRE_COMPILE_INITIALIZED = 0;
     if (!SRE_COMPILE_INITIALIZED && !init_sre_compile()) {
-        PyErr_Print();
-        abort();
+        if (!PyErr_ExceptionMatches(PyExc_DeprecationWarning)) {
+            PyErr_Print();
+            abort();
+        }
+        else {
+            PyErr_Clear();
+        }
     } else {
         SRE_COMPILE_INITIALIZED = 1;
     }
 
-    rv |= _run_fuzz(data, size, fuzz_sre_compile);
+    if (SRE_COMPILE_INITIALIZED) {
+        rv |= _run_fuzz(data, size, fuzz_sre_compile);
+    }
 #endif
 #if !defined(_Py_FUZZ_ONE) || defined(_Py_FUZZ_fuzz_sre_match)
     static int SRE_MATCH_INITIALIZED = 0;