[issue3242] Segfault in PyFile_SoftSpace/PyEval_EvalFrameEx with sys.stdout reassigned

Brodie Rao report at bugs.python.org
Tue Jul 1 03:04:37 CEST 2008


Brodie Rao <junk at dackz.net> added the comment:

Running with Python 2.5.2 with guard malloc on OS X 10.5 produces a 
similar crash to that of Python 2.4 on Linux:

(gdb) set env DYLD_INSERT_LIBRARIES /usr/lib/libgmalloc.dylib
(gdb) run ~/Documents/Code/py-crash/crash5.py
Starting program: /Users/brodie/Downloads/Python-2.5.2/python.exe 
~/Documents/Code/py-crash/crash5.py
GuardMalloc: Allocations will be placed on 16 byte boundaries.
GuardMalloc:  - Some buffer overruns may not be noticed.
GuardMalloc:  - Applications using vector instructions (e.g., SSE or 
Altivec) should work.
GuardMalloc: GuardMalloc version 18
GuardMalloc: Allocations will be placed on 16 byte boundaries.
GuardMalloc:  - Some buffer overruns may not be noticed.
GuardMalloc:  - Applications using vector instructions (e.g., SSE or 
Altivec) should work.
GuardMalloc: GuardMalloc version 18
Reading symbols for shared libraries +. done
Reading symbols for shared libraries .. done
GuardMalloc: Allocations will be placed on 16 byte boundaries.
GuardMalloc:  - Some buffer overruns may not be noticed.
GuardMalloc:  - Applications using vector instructions (e.g., SSE or 
Altivec) should work.
GuardMalloc: GuardMalloc version 18

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xb2f79e88
0x00044951 in PyObject_GetAttr (v=0xb2de7c50, name=0xb2de79c0) at 
Objects/object.c:1126
1126		if (tp->tp_getattro != NULL)
(gdb) info locals
tp = (PyTypeObject *) 0xb2f79e40
v = (PyObject *) 0xb2de7c50
name = (PyObject *) 0xb2de79c0
(gdb) print tp->tp_getattro
Cannot access memory at address 0xb2f79e88
(gdb) bt
#0  0x00044951 in PyObject_GetAttr (v=0xb2de7c50, name=0xb2de79c0) at 
Objects/object.c:1126
#1  0x00099409 in PyEval_EvalFrameEx (f=0xb31fdeb0, throwflag=0) at 
Python/ceval.c:1990
#2  0x0009f29a in PyEval_EvalCodeEx (co=0xb060ef50, globals=0xb002fd20, 
locals=0x0, args=0xb2dee8fc, argcount=2, kws=0x0, kwcount=0, defs=0x0, 
defcount=0, closure=0x0) at Python/ceval.c:2836
#3  0x0002c8ea in function_call (func=0xb0623cf0, arg=0xb2dee8f0, 
kw=0x0) at Objects/funcobject.c:517
#4  0x00008b07 in PyObject_CallFunctionObjArgs (callable=0xb0623cf0) at 
Objects/abstract.c:1861
#5  0x00068e05 in slot_tp_getattr_hook (self=0xb2de7c50, 
name=0xb2de79c0) at Objects/typeobject.c:4775
#6  0x00099409 in PyEval_EvalFrameEx (f=0xb31fbeb0, throwflag=0) at 
Python/ceval.c:1990
#7  0x0009f29a in PyEval_EvalCodeEx (co=0xb060ef50, globals=0xb002fd20, 
locals=0x0, args=0xb2dee8d4, argcount=2, kws=0x0, kwcount=0, defs=0x0, 
defcount=0, closure=0x0) at Python/ceval.c:2836
#8  0x0002c8ea in function_call (func=0xb0623cf0, arg=0xb2dee8c8, 
kw=0x0) at Objects/funcobject.c:517
#9  0x00008b07 in PyObject_CallFunctionObjArgs (callable=0xb0623cf0) at 
Objects/abstract.c:1861
#10 0x00068e05 in slot_tp_getattr_hook (self=0xb2de7c50, 
name=0xb2de79c0) at Objects/typeobject.c:4775
#11 0x00099409 in PyEval_EvalFrameEx (f=0xb31f9eb0, throwflag=0) at 
Python/ceval.c:1990
#12 0x0009f29a in PyEval_EvalCodeEx (co=0xb060ef50, globals=0xb002fd20, 
locals=0x0, args=0xb2dee8ac, argcount=2, kws=0x0, kwcount=0, defs=0x0, 
defcount=0, closure=0x0) at Python/ceval.c:2836
#13 0x0002c8ea in function_call (func=0xb0623cf0, arg=0xb2dee8a0, 
kw=0x0) at Objects/funcobject.c:517
#14 0x00008b07 in PyObject_CallFunctionObjArgs (callable=0xb0623cf0) at 
Objects/abstract.c:1861
#15 0x00068e05 in slot_tp_getattr_hook (self=0xb2de7c50, 
name=0xb2de79c0) at Objects/typeobject.c:4775
#16 0x00099409 in PyEval_EvalFrameEx (f=0xb31f7eb0, throwflag=0) at 
Python/ceval.c:1990
#17 0x0009f29a in PyEval_EvalCodeEx (co=0xb060ef50, globals=0xb002fd20, 
locals=0x0, args=0xb2dee884, argcount=2, kws=0x0, kwcount=0, defs=0x0, 
defcount=0, closure=0x0) at Python/ceval.c:2836
#18 0x0002c8ea in function_call (func=0xb0623cf0, arg=0xb2dee878, 
kw=0x0) at Objects/funcobject.c:517
#19 0x00008b07 in PyObject_CallFunctionObjArgs (callable=0xb0623cf0) at 
Objects/abstract.c:1861
#20 0x00068e05 in slot_tp_getattr_hook (self=0xb2de7c50, 
name=0xb2de79c0) at Objects/typeobject.c:4775

[...]

#1554 0x00008b07 in PyObject_CallFunctionObjArgs (callable=0xb0623cf0) 
at Objects/abstract.c:1861
#1555 0x00068e05 in slot_tp_getattr_hook (self=0xb2de7c50, 
name=0xb2de79c0) at Objects/typeobject.c:4775
#1556 0x00099409 in PyEval_EvalFrameEx (f=0xb2f8beb0, throwflag=0) at 
Python/ceval.c:1990
#1557 0x0009f29a in PyEval_EvalCodeEx (co=0xb060ef50, 
globals=0xb002fd20, locals=0x0, args=0xb2de967c, argcount=2, kws=0x0, 
kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2836
#1558 0x0002c8ea in function_call (func=0xb0623cf0, arg=0xb2de9670, 
kw=0x0) at Objects/funcobject.c:517
#1559 0x00008b07 in PyObject_CallFunctionObjArgs (callable=0xb0623cf0) 
at Objects/abstract.c:1861
#1560 0x00068e05 in slot_tp_getattr_hook (self=0xb2de7c50, 
name=0xb060d5c0) at Objects/typeobject.c:4775
#1561 0x00044a66 in PyObject_GetAttrString (v=0xb2de7c50, name=0xed255) 
at Objects/object.c:1069
#1562 0x00023455 in PyFile_SoftSpace (f=0xb2de7c50, newflag=0) at 
Objects/fileobject.c:2125
#1563 0x0009b819 in PyEval_EvalFrameEx (f=0xb2f51ea0, throwflag=0) at 
Python/ceval.c:1608
#1564 0x0009f29a in PyEval_EvalCodeEx (co=0xb0621410, 
globals=0xb002fd20, locals=0xb002fd20, args=0x0, argcount=0, kws=0x0, 
kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2836
#1565 0x0009f3a7 in PyEval_EvalCode (co=0xb0621410, globals=0xb002fd20, 
locals=0xb002fd20) at Python/ceval.c:494
#1566 0x000c31d7 in PyRun_FileExFlags (fp=0xa0125de0, 
filename=0xbffff06c, start=257, globals=0xb002fd20, locals=0xb002fd20, 
closeit=1, flags=0xbfffeecc) at Python/pythonrun.c:1273
#1567 0x000c3583 in PyRun_SimpleFileExFlags (fp=0xa0125de0, 
filename=0xbffff06c, closeit=1, flags=0xbfffeecc) at 
Python/pythonrun.c:879
#1568 0x000d1d27 in Py_Main (argc=1, argv=0xbfffef54) at 
Modules/main.c:523
#1569 0x00001bcc in _start ()
#1570 0x00001af9 in start ()

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3242>
_______________________________________


More information about the Python-bugs-list mailing list