Kronuz/pyScss — Issue #48: scss.Scss().compile(u"\xa0") causes Python (2.7.2) to segfault
Author: benjamn
Created: 2012-02-01 22:02:50+00:00
State: open

This seems to happen for any unicode string with unrecognized characters.

In case it matters, I used pip to install pyScss, which seemed to compile the _speedups module without any problems.

Here's a gdb session with a backtrace:

1:~/ans/venv/answeb/answeb/public% gdb python
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
...
Reading symbols from /home/ben/ans/venv/bin/python...done.
(gdb) run
Starting program: /home/ben/ans/venv/bin/python
warning: the debug information found in "/lib/ld-2.11.1.so" does not match "/lib/ld-linux.so.2" (CRC mismatch).

[Thread debugging using libthread_db enabled]
Python 2.7.2 (default, Aug 24 2011, 22:13:27)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from scss import Scss
>>> Scss().compile(u"\xa0")

Program received signal SIGSEGV, Segmentation fault.
BlockLocator_iternext (self=0x1) at scss/src/block_locator.c:440
440 scss/src/block_locator.c: No such file or directory.
in scss/src/block_locator.c
(gdb) bt
#0 BlockLocator_iternext (self=0x1) at scss/src/block_locator.c:440
#1 0xf79971d0 in scss_BlockLocator_iternext (self=0xf7e13310) at scss/src/_speedups.c:65
#2 0x080d7436 in PyEval_EvalFrameEx (f=0x81ebc94, throwflag=0) at Python/ceval.c:2497
#3 0x080de87b in PyEval_EvalCodeEx (co=0xf7d3d188, globals=0xf7d3157c, locals=0x0, args=0xf7d519a0, argcount=7, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#4 0x0813a697 in function_call (func=0xf7b2c8ec, arg=0xf7d51994, kw=0x0) at Objects/funcobject.c:526
#5 0x0805f675 in PyObject_Call (func=0xf7b2c8ec, arg=0xf7d51994, kw=0x0) at Objects/abstract.c:2529
#6 0x080da4b1 in ext_do_call (f=0x828a0bc, throwflag=0) at Python/ceval.c:4326
#7 PyEval_EvalFrameEx (f=0x828a0bc, throwflag=0) at Python/ceval.c:2705
#8 0x080de87b in PyEval_EvalCodeEx (co=0xf7d2d800, globals=0xf7d3157c, locals=0x0, args=0x826513c, argcount=7, kws=0x8265158, kwcount=0, defs=0x0, defcount=0, closure=0xf79155ec) at Python/ceval.c:3253
#9 0x080dc3fa in fast_function (f=0x8264fe4, throwflag=0) at Python/ceval.c:4109
#10 call_function (f=0x8264fe4, throwflag=0) at Python/ceval.c:4034
#11 PyEval_EvalFrameEx (f=0x8264fe4, throwflag=0) at Python/ceval.c:2666
#12 0x080de87b in PyEval_EvalCodeEx (co=0xf7d3d0f8, globals=0xf7d3157c, locals=0x0, args=0xf7e1db58, argcount=1, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#13 0x0813a697 in function_call (func=0xf7b2c87c, arg=0xf7e1db4c, kw=0x0) at Objects/funcobject.c:526
#14 0x0805f675 in PyObject_Call (func=0xf7b2c87c, arg=0xf7e1db4c, kw=0x0) at Objects/abstract.c:2529
#15 0x080da4b1 in ext_do_call (f=0x82e42fc, throwflag=0) at Python/ceval.c:4326
#16 PyEval_EvalFrameEx (f=0x82e42fc, throwflag=0) at Python/ceval.c:2705
#17 0x080de87b in PyEval_EvalCodeEx (co=0xf7d2d800, globals=0xf7d3157c, locals=0x0, args=0x81ed6b8, argcount=1, kws=0x81ed6bc, kwcount=0, defs=0x0, defcount=0, closure=0xf792266c) at Python/ceval.c:3253
#18 0x080dc3fa in fast_function (f=0x81ed564, throwflag=0) at Python/ceval.c:4109
#19 call_function (f=0x81ed564, throwflag=0) at Python/ceval.c:4034
#20 PyEval_EvalFrameEx (f=0x81ed564, throwflag=0) at Python/ceval.c:2666
#21 0x080de87b in PyEval_EvalCodeEx (co=0xf7d2dbf0, globals=0xf7d3157c, locals=0x0, args=0xf7d35ef8, argcount=2, kws=0x0, kwcount=0, defs=0xf7b29db8, defcount=1, closure=0x0) at Python/ceval.c:3253
#22 0x0813a697 in function_call (func=0xf7b2c6f4, arg=0xf7d35eec, kw=0x0) at Objects/funcobject.c:526
#23 0x0805f675 in PyObject_Call (func=0xf7b2c6f4, arg=0xf7d35eec, kw=0x0) at Objects/abstract.c:2529
#24 0x080da4b1 in ext_do_call (f=0x827094c, throwflag=0) at Python/ceval.c:4326
#25 PyEval_EvalFrameEx (f=0x827094c, throwflag=0) at Python/ceval.c:2705
#26 0x080de87b in PyEval_EvalCodeEx (co=0xf7d2d800, globals=0xf7d3157c, locals=0x0, args=0x82eb0b4, argcount=2, kws=0x82eb0bc, kwcount=0, defs=0x0, defcount=0, closure=0xf792d7cc) at Python/ceval.c:3253
#27 0x080dc3fa in fast_function (f=0x82eaf7c, throwflag=0) at Python/ceval.c:4109
#28 call_function (f=0x82eaf7c, throwflag=0) at Python/ceval.c:4034
#29 PyEval_EvalFrameEx (f=0x82eaf7c, throwflag=0) at Python/ceval.c:2666
#30 0x080de87b in PyEval_EvalCodeEx (co=0xf7d28380, globals=0xf7e1135c, locals=0xf7e1135c, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#31 0x080de9c7 in PyEval_EvalCode (co=0xf7d28380, globals=0xf7e1135c, locals=0xf7e1135c) at Python/ceval.c:667
#32 0x080fe8c0 in run_mod (fp=0xf7f79440, filename=0x81557d6 "", flags=0xffffd158) at Python/pythonrun.c:1346
#33 PyRun_InteractiveOneFlags (fp=0xf7f79440, filename=0x81557d6 "", flags=0xffffd158) at Python/pythonrun.c:845
#34 0x080feae6 in PyRun_InteractiveLoopFlags (fp=0xf7f79440, filename=0x81557d6 "", flags=0xffffd158) at Python/pythonrun.c:765
#35 0x080ff362 in PyRun_AnyFileExFlags (fp=0xf7f79440, filename=0x81557d6 "", closeit=0, flags=0xffffd158) at Python/pythonrun.c:734
#36 0x0805b776 in Py_Main (argc=0, argv=0xffffd244) at Modules/main.c:599
#37 0x0805a992 in main (argc=-136993728, argv=0x81c00a4) at ./Modules/python.c:23
(gdb)

If I can provide any additional information, just let me know.