diff Python/sysmodule.c @ 75100:6b7704fe1be1 2.6

- Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED environment variable, to provide an opt-in way to protect against denial of service attacks due to hash collisions within the dict and set types. Patch by David Malcolm, based on work by Victor Stinner.
author Barry Warsaw <barry@python.org>
date Mon, 20 Feb 2012 20:42:21 -0500
parents b99c94261225
children a0f43f4481e0
line wrap: on
line diff
--- a/Python/sysmodule.c	Mon Feb 20 14:43:22 2012 -0500
+++ b/Python/sysmodule.c	Mon Feb 20 20:42:21 2012 -0500
@@ -1224,6 +1224,7 @@
     {"unicode",                 "-U"},
     /* {"skip_first",                   "-x"}, */
     {"bytes_warning", "-b"},
+    {"hash_randomization", "-R"},
     {0}
 };
 
@@ -1232,9 +1233,9 @@
     flags__doc__,       /* doc */
     flags_fields,       /* fields */
 #ifdef RISCOS
-    16
+    17
 #else
-    15
+    16
 #endif
 };
 
@@ -1271,6 +1272,7 @@
     SetFlag(Py_UnicodeFlag);
     /* SetFlag(skipfirstline); */
     SetFlag(Py_BytesWarningFlag);
+    SetFlag(Py_HashRandomizationFlag);
 #undef SetFlag
 
     if (PyErr_Occurred()) {