Annotation of pkgsrc/lang/python26/patches/patch-CVE-2012-1150-Python_pythonrun.c, revision 1.1
1.1 ! tron 1: $NetBSD$
! 2:
! 3: Fix for CVE-2012-1150 taken from here:
! 4:
! 5: http://hg.python.org/cpython/rev/6b7704fe1be1
! 6:
! 7: --- Python/pythonrun.c.orig 2010-05-25 23:40:38.000000000 +0100
! 8: +++ Python/pythonrun.c 2012-03-25 09:51:50.000000000 +0100
! 9: @@ -67,6 +67,7 @@
! 10: static void call_ll_exitfuncs(void);
! 11: extern void _PyUnicode_Init(void);
! 12: extern void _PyUnicode_Fini(void);
! 13: +extern void _PyRandom_Init(void);
! 14:
! 15: #ifdef WITH_THREAD
! 16: extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
! 17: @@ -89,6 +90,7 @@
! 18: true divisions (which they will be in 2.3). */
! 19: int _Py_QnewFlag = 0;
! 20: int Py_NoUserSiteDirectory = 0; /* for -s and site.py */
! 21: +int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */
! 22:
! 23: /* PyModule_GetWarningsModule is no longer necessary as of 2.6
! 24: since _warnings is builtin. This API should not be used. */
! 25: @@ -166,6 +168,12 @@
! 26: Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
! 27: if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
! 28: Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
! 29: + /* The variable is only tested for existence here; _PyRandom_Init will
! 30: + check its value further. */
! 31: + if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')
! 32: + Py_HashRandomizationFlag = add_flag(Py_HashRandomizationFlag, p);
! 33: +
! 34: + _PyRandom_Init();
! 35:
! 36: interp = PyInterpreterState_New();
! 37: if (interp == NULL)
CVSweb <webmaster@jp.NetBSD.org>