Closed 90baf024-6604-450d-8341-d796fe6858f3 closed 15 years ago
The following code causes a segfault for me:
import sys; sys.call_tracing(type,2)
Running on: Python 3.0b3+ (py3k:66015, Aug 24 2008, 16:21:19) [GCC 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)] on linux2
gdb output: [New Thread -1210857280 (LWP 8823)] python: Objects/typeobject.c:1854: type_new: Assertion `args != ((void *)0) && ((((((PyObject*)(args))->ob_type))->tp_flags & ((1L\<\<26))) != 0)' failed.
Program received signal SIGABRT, Aborted. [Switching to Thread -1210857280 (LWP 8823)] 0xffffe410 in __kernel_vsyscall () (gdb) backtrace
kwds=0x0) at Objects/typeobject.c:1854
kw=0x0) at Objects/methodobject.c:81
locals=0xb7f0b5d4, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0) at Python/ceval.c:2840
locals=0xb7f0b5d4) at Python/ceval.c:519
globals=0xb7f0b5d4, locals=0xb7f0b5d4, flags=0xbf9b6f60, arena=0x82b1060) at Python/pythonrun.c:1560
sys.call_tracing(type,2)\n", start=257, globals=0xb7f0b5d4, locals=0xb7f0b5d4, flags=0xbf9b6f60) at Python/pythonrun.c:1494
sys; sys.call_tracing(type,2)\n", flags=0xbf9b6f60) at Python/pythonrun.c:1073
The function call fails much earlier in debug builds. sys_call_tracing() doesn't check the type of the second argument. It must be a tuple because it's directly passed to the PyObject_Call() API.
Suggestion: Add an explicit type check for PyTupleType the sys_call_tracing() function
Check 2.6, too
Not applicable in 2.6:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: type() takes 1 or 3 arguments
This bug should be fixed for rc2, but it doesn't need to block rc1.
Attaching patch.
r66949
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields: ```python assignee = None closed_at =
created_at =
labels = ['interpreter-core', 'type-crash', 'release-blocker']
title = 'sys.call_tracing segfaults'
updated_at =
user = 'https://github.com/devdanzin'
```
bugs.python.org fields:
```python
activity =
actor = 'barry'
assignee = 'none'
closed = True
closed_date =
closer = 'barry'
components = ['Interpreter Core']
creation =
creator = 'ajaksu2'
dependencies = []
files = ['11702']
hgrepos = []
issue_num = 3661
keywords = ['patch', 'needs review']
message_count = 6.0
messages = ['71853', '71856', '71857', '72458', '74320', '74887']
nosy_count = 4.0
nosy_names = ['barry', 'christian.heimes', 'ajaksu2', 'benjamin.peterson']
pr_nums = []
priority = 'release blocker'
resolution = 'accepted'
stage = None
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue3661'
versions = ['Python 3.0']
```