Segfault with map operation on 1.8p5

Hello,

while reading the discussion about segfault in Array#map comes to my
mind that this couldn’t be so rare segfault…

Please look at suspicious peaces of code. To name it - look at line 261,
and 1570 (in latest CVS). There are potencial segfaults.

While 841 is not a segfault, but could give a garbage like Qundef.

And 1438 could give Qnil…

I think that some king of locking needs to be used (like ARY_TMPLOCK).

I think that the other classes (not just Array) are affected like this
as well.

I hope I’m wrong so correct me, please!

Michal

PS: I’m so sorry that I won’t be able to respond back - I’m out of town
for a week… So please, CC me to stay in discussion.

···


-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michal Rokos Czech Technical University, Prague
e-mail: m.rokos@sh.cvut.cz icq: 36118339 jabber: majkl@jabber.cz
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Hi,

Please look at suspicious peaces of code. To name it - look at line 261,
and 1570 (in latest CVS). There are potencial segfaults.

line 261 will not be a problem. It’s in the “initialize” so that the
ary is not yet revealed to the script.

While 841 is not a segfault, but could give a garbage like Qundef.

And 1438 could give Qnil…

I fixed problems at lines 841, 1438, and 1570, by checking length for
each iteration.

I think that the other classes (not just Array) are affected like this
as well.

Yep, I’m going to check. Thank you.

						matz.
···

In message “Re: Segfault with map operation on 1.8p5” on 03/08/01, Michal Rokos m.rokos@sh.cvut.cz writes: