comparison 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
comparison
equal deleted inserted replaced
75067:90ec0bc01f3b 75100:6b7704fe1be1
1222 #endif 1222 #endif
1223 /* {"unbuffered", "-u"}, */ 1223 /* {"unbuffered", "-u"}, */
1224 {"unicode", "-U"}, 1224 {"unicode", "-U"},
1225 /* {"skip_first", "-x"}, */ 1225 /* {"skip_first", "-x"}, */
1226 {"bytes_warning", "-b"}, 1226 {"bytes_warning", "-b"},
1227 {"hash_randomization", "-R"},
1227 {0} 1228 {0}
1228 }; 1229 };
1229 1230
1230 static PyStructSequence_Desc flags_desc = { 1231 static PyStructSequence_Desc flags_desc = {
1231 "sys.flags", /* name */ 1232 "sys.flags", /* name */
1232 flags__doc__, /* doc */ 1233 flags__doc__, /* doc */
1233 flags_fields, /* fields */ 1234 flags_fields, /* fields */
1234 #ifdef RISCOS 1235 #ifdef RISCOS
1236 17
1237 #else
1235 16 1238 16
1236 #else
1237 15
1238 #endif 1239 #endif
1239 }; 1240 };
1240 1241
1241 static PyObject* 1242 static PyObject*
1242 make_flags(void) 1243 make_flags(void)
1269 #endif 1270 #endif
1270 /* SetFlag(saw_unbuffered_flag); */ 1271 /* SetFlag(saw_unbuffered_flag); */
1271 SetFlag(Py_UnicodeFlag); 1272 SetFlag(Py_UnicodeFlag);
1272 /* SetFlag(skipfirstline); */ 1273 /* SetFlag(skipfirstline); */
1273 SetFlag(Py_BytesWarningFlag); 1274 SetFlag(Py_BytesWarningFlag);
1275 SetFlag(Py_HashRandomizationFlag);
1274 #undef SetFlag 1276 #undef SetFlag
1275 1277
1276 if (PyErr_Occurred()) { 1278 if (PyErr_Occurred()) {
1277 return NULL; 1279 return NULL;
1278 } 1280 }