MantisBT - mSLDev
View Issue Details
0000158mSLDevSyntax Checkingpublic2013-05-31 01:502013-06-04 17:49
Wims 
administrator 
immediatecrashalways
closedfixed 
 
0.4.1.0 
0000158: Crash with some $iif
Code:

;MAIN LOOP
alias pacman_loop {
  if (!$window(@pacman)) return
  if ($1) {
    if ($calc($ticks - $hget(pacclient,ticks)) >= 1000) { hadd pacclient ticks $ticks | hadd pacclient fps $hget(pacclient,cticks) | hdel pacclient cticks }
    if (!$hget(pacclient,msg)) {
      hinc pacclient time
      if ($hget(pacclient,bonus)) hinc pacclient btime
    }
  }
  var %h $hget(pacclient,height),%a 1,%? $1,%c
  drawcopy -n @Pac_buf 0 $gettok($sizesprite,2,32) $hget(pacclient_db,size) @Pacman 0 %h
  while ($hget(pacclienti,%a).item) {
    var %c = $v1
    if (!$window(@pacman)) return
    tokenize 32 $sizesprite $hget(pacclienti,%c)
    var %dr $iif($4 < 0,$calc(14 $4))
    if (pacman* iswm %c) {
      var %x $iif($5 isin 3739,2,$iif($istok(38 40,$5,32),0,2))
      drawcopy -nt @Pacani_buf 16711935 $calc(%x * $1 + $iif($8 || $hget(pacclient,msg),0,$hget(pacclient,anim))) 0 $1 $iif(%dr,%dr,$2) @Pacman $&
        $calc($3 $iif($5 == 39,+ $1 -1)) $iif(%dr != $null && $5 == 40,$calc(%h + %dr),$calc(%h + $4 $iif($5 == 40,+ $2 -1))) $&
        $iif($5 == 39,-) $+ $1 $iif($5 == 40,-) $+ $iif(%dr == $null,$2,%dr)
if ($hget(pacclient,nick) == $9) drawdot -rn @pacman 255 2 $calc($3 $iif($5 == 39,+ $1 -1)) $iif(%dr != $null && $5 == 40,$calc(%h + %dr + 7),$calc(%h + $4 + $iif($5 =$iif())))
    }
    else {
      var %x $iif($7,$iif($calc($hget(pacclient,cli)) == 0 || $v1 == 2,0,2),$iif($5 isin 3739,4,$iif($5 == 38,0,2))) ,%y $iif($7,5,$remove(%c,ghost))
      drawcopy -nt @pacani_buf 16711935 $&
        $calc(%x * $1 + $iif($8 || $hget(pacclient,msg),0,$hget(pacclient,anim))) $calc(%y * $2 $iif(%dr != $null,+ $2 - %dr)) $1 $iif(%dr != $null,%dr,$2) @Pacman $&
        $calc($3 $iif($5 == 39,+ $1 -1)) $calc(%h $iif(%dr == $null,+ $4) $iif($5 == 40 && %dr == $null,-1)) $iif($5 == 39,-) $+ $1 $iif(%dr,%dr,$2)
    }
    inc %a
  }
  if ($timer(pacclientgo)) {
    var %xd $int($calc($window(@pacman).bw / 2 - $pic($scriptdirgo.png).width / 2)),%yd $int($calc(($window(@pacman).bh - %h) / 2 - $pic($scriptdirgo.png).height / 2)) + %h
    drawpic -ct @pacman 16777215 %xd %yd $qt($scriptdirgo.png)
  }
  elseif ($hget(pacclient,msg)) $v1
  if (%?) {
    drawdot @Pacman
    if (!$calc($hget(pacclient,time) % 10)) hadd pacclient anim $iif($hget(pacclient,anim),0,$1)
    if (!$calc($hget(pacclient,time) % 17)) && ($hget(pacclient,cli)) hadd pacclient cli $iif($hget(pacclient,cli) == 2,1,2)
    hinc pacclient cticks
    .timerpacclient -ho 1 0 pacman_loop 1
    ;if ($hget(pacclient,fps)) titlebar @pacman fps: $v1
  }
}
In this mess, notice the line:

if ($hget(pacclient,nick) == $9) drawdot -rn @pacman 255 2 $calc($3 $iif($5 == 39,+ $1 -1)) $iif(%dr != $null && $5 == 40,$calc(%h + %dr + 7),$calc(%h + $4 + $iif($5 =$iif())))

This is what the app restore for me, but while editing the code, it was originally:

if ($hget(pacclient,nick) == $9) drawdot -rn @pacman 255 2 $calc($3 $iif($5 == 39,+ $1 -1)) $iif(%dr != $null && $5 == 40,$calc(%h + %dr + 7),$calc(%h + $4 + |))

| is the cursor.

From there, I manage to get this (I disabled some options, it doesn't add the ')' automatically, you should be able to get there with any options enabled without crashing):

if ($hget(pacclient,nick) == $9) drawdot -rn @pacman 255 2 $calc($3 $iif($5 == 39,+ $1 -1)) $iif(%dr != $null && $5 == 40,$calc(%h + %dr + 7),$calc(%h + $4 + $iif(|$iif())))

Notice the cursor position, now type "$5 ==" or try to type i might say, because there, msldev should freeze and crash a few seconds later.
I have two options disabled: the () deletion and the ')' completion.
No tags attached.
Issue History
2013-05-31 01:50WimsNew Issue
2013-05-31 14:37administratorSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=73#r73
2013-06-04 03:30TravisNote Added: 0000107
2013-06-04 03:32TravisNote Edited: 0000107bug_revision_view_page.php?bugnote_id=107#r75
2013-06-04 03:37TravisNote Edited: 0000107bug_revision_view_page.php?bugnote_id=107#r76
2013-06-04 03:38TravisNote Edited: 0000107bug_revision_view_page.php?bugnote_id=107#r77
2013-06-04 17:49administratorStatusnew => closed
2013-06-04 17:49administratorAssigned To => administrator
2013-06-04 17:49administratorResolutionopen => fixed
2013-06-04 17:49administratorFixed in Version => 0.4.1.0

Notes
(0000107)
Travis   
2013-06-04 03:30   
(edited on: 2013-06-04 03:38)
alias foo noop $calc($iif(=$iif()))
alias bar noop $calc($iif(=$foo()))

Both produce a crash.