From 12897d7d395f5907e0f9a3694ba3c64c329db0dd Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 20 Feb 2012 23:49:29 +0100 Subject: Fix typo in conditional. --- Python/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/random.c b/Python/random.c index 327166e..01cd83a 100644 --- a/Python/random.c +++ b/Python/random.c @@ -269,7 +269,7 @@ _PyRandom_Init(void) */ env = Py_GETENV("PYTHONHASHSEED"); - if (env && *env != '\0' & strcmp(env, "random") != 0) { + if (env && *env != '\0' && strcmp(env, "random") != 0) { char *endptr = env; unsigned long seed; seed = strtoul(env, &endptr, 10); -- cgit v0.12 From 06b1c4f68bca367bf2a2c8ce9bf36168ccb2f9ef Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 20 Feb 2012 23:09:59 +0100 Subject: Fix typo. --- Misc/NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index 486da13..0d23663 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -11,7 +11,7 @@ Core and Builtins ----------------- - Issue #13703: oCERT-2011-003: add -R command-line option and PYTHONHASHSEED - environment variables, to provide an opt-in way to protect against denial of + 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. -- cgit v0.12 From 7c573f7a075fd8fc7bf90bdbcc4f163cda3b9acf Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 20 Feb 2012 22:48:06 +0100 Subject: Fix dbm_gnu test relying on set order. --- Lib/test/test_dbm_gnu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_dbm_gnu.py b/Lib/test/test_dbm_gnu.py index 2173b92..f77dcfe 100755 --- a/Lib/test/test_dbm_gnu.py +++ b/Lib/test/test_dbm_gnu.py @@ -49,7 +49,7 @@ class TestGdbm(unittest.TestCase): all = set(gdbm.open_flags) # Test standard flags (presumably "crwn"). modes = all - set('fsu') - for mode in modes: + for mode in sorted(modes): # put "c" mode first self.g = gdbm.open(filename, mode) self.g.close() -- cgit v0.12 From 9571155ae4ff86b4275950fcdfadcc76475943e3 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 20 Feb 2012 22:06:02 +0100 Subject: Remove setting hash seed to regrtest's random seed and re-execv()ing: this doesn't preserve Python flags and fails from a temp directory. --- Lib/test/regrtest.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index d203600..98d68bd 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -428,11 +428,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, except ValueError: print("Couldn't find starting test (%s), using all tests" % start) if randomize: - hashseed = os.getenv('PYTHONHASHSEED') - if not hashseed: - os.environ['PYTHONHASHSEED'] = str(random_seed) - os.execv(sys.executable, [sys.executable] + sys.argv) - return random.seed(random_seed) print("Using random seed", random_seed) random.shuffle(tests) -- cgit v0.12 From 91e5c08fe8a7b682099606ab48ef965833981a9a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Mon, 20 Feb 2012 23:49:29 +0100 Subject: Fix typo in conditional. --- Python/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/random.c b/Python/random.c index 327166e..01cd83a 100644 --- a/Python/random.c +++ b/Python/random.c @@ -269,7 +269,7 @@ _PyRandom_Init(void) */ env = Py_GETENV("PYTHONHASHSEED"); - if (env && *env != '\0' & strcmp(env, "random") != 0) { + if (env && *env != '\0' && strcmp(env, "random") != 0) { char *endptr = env; unsigned long seed; seed = strtoul(env, &endptr, 10); -- cgit v0.12