Re: Rob: Q: Euphoria 2.6 + PD source bug (important)

new topic     » topic index » view thread      » older message » newer message

Vincent wrote:
> Error Message:
> .\play_game.ew:941 in function play_game()
> subscript value 3 is out of bounds, reading from a sequence of length 2
> 
> Line that leads to failure:
> 
> particles[i][3..4] *= .95
> 
> Me and Liquid Nitrogen have determinded the bug is located in execute.e
> (backend) with PD intepreter that this routine is where its located,
> though we could be wrong..
> 
> Perhaps check this..
> 
> procedure opPASSIGN_OP_SLICE()
> -- var[subs] ... [i..j] op= expr
>     object x
> 
>     a = Code[pc+1]
>     x = val[a]
>     b = Code[pc+2]
>     if val[b] > length(x) or val[b] < 1 then
> 	RTFatal(
> 	sprintf("subscript value %d is out of bounds, reading from a sequence of
> length %d",
> 		{val[b], length(x)}))
>     end if
>     c = Code[pc+3]
>     target = Code[pc+4]
>     lhs_seq_index = val[a][1]
>     lhs_subs = val[a][2..length(val[a])]
>     Code[pc+10] = Code[pc+1]
>     val[target] = var_slice(val[lhs_seq_index], lhs_subs, val[b], val[c])
>     pc += 5
> end procedure

Thanks for reporting this bug.
It only affects the PD source backend (execute.e).
My corrected version of opPASSIGN_OP_SLICE is below...

procedure opPASSIGN_OP_SLICE()
-- var[subs] ... [i..j] op= expr
    object x

    a = Code[pc+1]
    x = val[a]
    b = Code[pc+2]
    c = Code[pc+3]
    target = Code[pc+4]
    lhs_seq_index = x[1]
    lhs_subs = x[2..$]
    Code[pc+10] = Code[pc+1]
    val[target] = var_slice(val[lhs_seq_index], lhs_subs, val[b], val[c])
    pc += 5
end procedure


Essentially, the if statement was not supposed to be there.

This is a very rare operation. It only comes into play
when you have an assignment op on a slice, after at least
one subscript has already been applied.

There are a couple of other known bugs in the PD source,
but they are very minor:
   - failure to check subscripts for errors in a couple of places
     (PD source will crash, rather than the incorrect user's program)
   - source line longer than 10,000 characters causes a crash
     (official interpreter too)

These bugs have been fixed, but not thoroughly tested.
When I accumulate enough bug fixes, I'll probably issue
a 2.5.1 release.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu