bpo-40998: Address compiler warnings found by ubsan (GH-20929)


Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: GH:tiran
(cherry picked from commit 07f2adedf0940b06d136208ec386d69b7d2d5b43)

Co-authored-by: Christian Heimes <christian@python.org>
diff --git a/Parser/pegen/parse_string.c b/Parser/pegen/parse_string.c
index 7b02bdd..fb0c4af 100644
--- a/Parser/pegen/parse_string.c
+++ b/Parser/pegen/parse_string.c
@@ -74,6 +74,9 @@
         return NULL;
     }
     p = buf = PyBytes_AsString(u);
+    if (p == NULL) {
+        return NULL;
+    }
     end = s + len;
     while (s < end) {
         if (*s == '\\') {