Blob Blame History Raw
diff -ru subprocess32-3.2.6/_posixsubprocess_helpers.c subprocess32-3.2.6_patched/_posixsubprocess_helpers.c
--- subprocess32-3.2.6/_posixsubprocess_helpers.c	2012-06-09 08:31:40.000000000 +0200
+++ subprocess32-3.2.6_patched/_posixsubprocess_helpers.c	2018-08-22 16:38:07.485734481 +0200
@@ -110,6 +110,12 @@
     if (argc == -1)
         return NULL;

+    /* Avoid 32-bit overflows to malloc() from unreasonable values. */
+    if (argc > 0x10000000) {
+        PyErr_NoMemory();
+        return NULL;
+    }
+
     array = malloc((argc + 1) * sizeof(char *));
     if (array == NULL) {
         PyErr_NoMemory();