[#9722] Kernel#system broken inside Dir.chdir(&block) if system command doesn't have shell characters — <noreply@...>

Bugs item #7278, was opened at 2006-12-14 13:59

8 messages 2006/12/14

[#9749] System V IPC in standard library? — Steven Jenkins <steven.jenkins@...>

Back in August, I needed a semaphore to serialize access to an external

14 messages 2006/12/19

[#9753] CVS freeze — SASADA Koichi <ko1@...>

Hi,

20 messages 2006/12/20
[#9755] Re: [ruby-dev:30039] CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

[#9757] Re: [ruby-dev:30040] Re: CVS freeze — SASADA Koichi <ko1@...> 2006/12/20

Hi,

Re: [ ruby-Bugs-7202 ] String#[]= decimal bug

From: Lei Ming <ming.lei@...>
Date: 2006-12-20 11:09:15 UTC
List: ruby-core #9760
Hi,

See the source code of the rb_str_aset function in string.c 
(version 1.8.5-p2):

   1723     switch (TYPE(indx)) {
   1724       case T_FIXNUM:
   1725       num_index:
   1726         idx = FIX2LONG(indx);
   1727         if (RSTRING(str)->len <= idx) {


<...>

   1770         idx = NUM2LONG(indx);
   1771         goto num_index;

It seems the label "num_index" has been put on a wrong position. It 
should be moved after line 1726, or the integer value idx, extraced from 
the float value of indx at line 1770, will be overwritten at line 1726 
and get a wrong integer value converted incorrectly (right shift one 
bit) from the original float value, which is of course out of range.

The rb_str_aref function doesn't have this problem, so reading access of 
the string is OK.

Please fix this.

Thanks,
Lei Ming

On Sun, Dec 10, 2006 at 01:21:15PM +0900, noreply@rubyforge.org wrote:
> Bugs item #7202, was opened at 2006-12-09 23:21
> You can respond by visiting: 
> http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7202&group_id=426
> 
> Category: Standard Library
> Group: 1.8.x
> Status: Open
> Resolution: None
> Priority: 3
> Submitted By: Darren Smith (flagitious)
> Assigned to: Nobody (None)
> Summary: String#[]= decimal bug
> 
> Initial Comment:
> a='asdf'
> a[1] -> 115
> a[1.0] -> 115
> a[1]=110 -> 110
> a[1.0]=110 -> IndexError: index 9675114 out of string
> 
> This problem does not seem to happen if the variable 'a' is an Array.
> 
> The bug occurred on: ruby 1.8.4 (2005-12-24) [powerpc-darwin7.9.0]
> and: ruby 1.8.5 (2006-08-25) [x86_64-freebsd6.1]
> 
> ----------------------------------------------------------------------
> 
> You can respond by visiting: 
> http://rubyforge.org/tracker/?func=detail&atid=1698&aid=7202&group_id=426

In This Thread

Prev Next