[Python-checkins] CVS: python/dist/src/Python pythonrun.c,2.149,2.150

Barry Warsaw bwarsaw@users.sourceforge.net
2001年11月13日 15:08:28 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv31738
Modified Files:
	pythonrun.c 
Log Message:
PyOS_getsig(), PyOS_setsig(): The minimal amount of work to avoid the
uninitialized memory reads reported in bug #478001.
Note that this doesn't address the following larger issues:
- Error conditions are not documented for PyOS_*sig() in the C API.
- Nothing that actually calls PyOS_*sig() in the core interpreter and
 extension modules actually /checks/ the return value of the call.
Fixing those is left as an exercise for a later day.
Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.149
retrieving revision 2.150
diff -C2 -d -r2.149 -r2.150
*** pythonrun.c	2001年10月12日 22:14:26	2.149
--- pythonrun.c	2001年11月13日 23:08:26	2.150
***************
*** 1438,1441 ****
--- 1438,1447 ----
 #ifdef HAVE_SIGACTION
 	struct sigaction context;
+ 	/* Initialize context.sa_handler to SIG_ERR which makes about as
+ 	 * much sense as anything else. It should get overwritten if
+ 	 * sigaction actually succeeds and otherwise we avoid an
+ 	 * uninitialized memory read.
+ 	 */
+ 	context.sa_handler = SIG_ERR;
 	sigaction(sig, NULL, &context);
 	return context.sa_handler;
***************
*** 1454,1457 ****
--- 1460,1469 ----
 	struct sigaction context;
 	PyOS_sighandler_t oldhandler;
+ 	/* Initialize context.sa_handler to SIG_ERR which makes about as
+ 	 * much sense as anything else. It should get overwritten if
+ 	 * sigaction actually succeeds and otherwise we avoid an
+ 	 * uninitialized memory read.
+ 	 */
+ 	context.sa_handler = SIG_ERR;
 	sigaction(sig, NULL, &context);
 	oldhandler = context.sa_handler;

AltStyle によって変換されたページ (->オリジナル) /