poppopjmp / shedskin

Automatically exported from code.google.com/p/shedskin
0 stars 0 forks source link

Crash when using string.split() #154

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Compile and run the following code:

a = 
'7,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,2,1,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,2,2,1,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,3,1,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'
b = 
'7,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,2,1,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,2,2,1,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,3,1,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'
c = 
'7,0,1,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,2,1,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,0,0,0,0,2,2,1,0,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,3,1,0,0
,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0'

while True:
    d = a.split(',')
    d = b.split(',')
    d = c.split(',')

What is the expected output? What do you see instead?

Segfaults for some reason. Doesn't happen under gdb, which makes the problem 
even trickier.

What version of the product are you using? On what operating system?

0.9, OS X 10.7.0, gcc 4.2.1

Original issue reported on code.google.com by inn...@gmail.com on 13 Sep 2011 at 3:27

GoogleCodeExporter commented 8 years ago
thanks for reporting! 

unfortunately I can't directly reproduce the problem here.. I will have a look 
at the 'split' implementation later this week to see if something is going 
wrong in there. 

Original comment by mark.duf...@gmail.com on 13 Sep 2011 at 6:10

GoogleCodeExporter commented 8 years ago
hmm, I tried this on two different systems, and had a look at the str.split 
implementation, and also compared it for 1 million pseudo-random strings, but I 
can't reproduce or explain the problem yet.. do other programs work fine? which 
version of libgc are you using? are you sure this is the whole program..?

Original comment by mark.duf...@gmail.com on 15 Sep 2011 at 2:08

GoogleCodeExporter commented 8 years ago
Other programs don't actually work very fine - that's one particular snippet of 
code that will always crash. I'm using version 7.1 of gc - and that's not the 
whole program, it's a minimized test case that triggers the crash.

Odd enough, it only seems to happen on Lion for some reason. Works fine on Snow 
Leopard, even if it's using the same version of gcc. (according to --version, 
but who knows what's in there)

Anything else worth trying? Twiddling with optimization flags?

Original comment by inn...@gmail.com on 2 Oct 2011 at 9:13

GoogleCodeExporter commented 8 years ago
Same here. Mac OS Lion, split causes Sementation fault.

Original comment by jakub.ji...@gmail.com on 3 Oct 2011 at 3:08

GoogleCodeExporter commented 8 years ago
Seems to happen only on big string though. I'm attaching a code snippet and 
file that caused it. I don't have linux here so I can't try that there.

Original comment by jakub.ji...@gmail.com on 3 Oct 2011 at 3:22

Attachments:

GoogleCodeExporter commented 8 years ago
thanks guys. this second example also seem to work fine here.. playing with the 
shedskin optimization flags probably won't help, as they're already quite 
conservative on OSX (only -O2). I will ask a colleague who uses lion to see if 
he can reproduce the problem.

Original comment by mark.duf...@gmail.com on 11 Oct 2011 at 3:32

GoogleCodeExporter commented 8 years ago
hmmmm:

http://laclefyoshi.blogspot.com/2011/08/compiling-gc-71-on-mac-os-x-lion-but.htm
l

did apple just dump gcc..

Original comment by mark.duf...@gmail.com on 7 Nov 2011 at 8:59

GoogleCodeExporter commented 8 years ago
Reproduced error and found segfaulty error in the vicinity of the reproduced 
error.

std::basic_string<char, std::char_traits<char>, gc_allocator<char> 
>::_S_construct<char*> (__beg=0x101 <Address 0x101 out of bounds>, 
__end=0x100173acc " 15 200 45 241 35 189
3 182 6 163 24 249 2 110 9 230 22 200 37 128 1 220 4 15 40 231 41 209 21 53 29 
240\n", __a=@0x7fff5fbffa38) at re.cpp:153

I thought I could be more helpful, but my C++ brain hurts and CGDB makes me 
want to kill myself.

OS X Lion with stock g++ (i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based 
on Apple Inc. build 5658) (LLVM build 2336.1.00)).

Original comment by bpcle...@gmail.com on 18 May 2012 at 5:32

Attachments:

GoogleCodeExporter commented 8 years ago
Would it be possible to see bt when that happens?

Original comment by inn...@gmail.com on 18 May 2012 at 5:38