HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Does 1.24b still have typecasting bug and/or arbitrary code bug?

09-21-2009, 09:19 AM#1
Kathune
So has blizzard truly fixed it or not?
09-21-2009, 09:59 AM#2
DioD
go and test, post results later plz.
09-21-2009, 12:52 PM#3
Kathune
The problem is, I don't know if this bug is still there.

And, even if it was still there I don't know how to code the map to test it, it may need some new way to carry out.

the old fashion way certainly won't do.

function H2I takes handle h returns integer
return h
return 0
endfunction
09-23-2009, 03:51 AM#4
azlier
There is indeed another return bug. It works. Code execution works. Executing code outside bounds does not work, from what I hear.

C2I and I2C need to be passed through cleaner functions with the newly discovered Return Nothing bug.

Yes, I think this is the C2I that works with Patch 1.24b.

Collapse JASS:
function Code takes code c returns code
    return c
endfunction

function Integer takes integer i returns integer
    return i
endfunction

function I2CHelper takes integer i returns code
    call Integer(i)
    if false then
        return null
    endif
endfunction

function I2C takes integer i returns code
    return Code(I2CHelper(i))
endfunction

function C2IHelper takes code c returns integer
    call Code(i)
    if false then
        return 0
    endif
endfunction

function C2I takes code c returns integer
    return Integer(C2IHelper(c))
endfunction
09-23-2009, 04:38 AM#5
ToukoAozaki
Now Blizzard would need to introduce "not all code paths return a value" check. Would be an annoying task for them indeed.
09-24-2009, 11:22 PM#6
Kathune
Quote:
Originally Posted by azlier
There is indeed another return bug. It works. Code execution works. Executing code outside bounds does not work, from what I hear.

C2I and I2C need to be passed through cleaner functions with the newly discovered Return Nothing bug.

Yes, I think this is the C2I that works with Patch 1.24b.

Collapse JASS:
function Code takes code c returns code
    return c
endfunction

function Integer takes integer i returns integer
    return i
endfunction

function I2CHelper takes integer i returns code
    call Integer(i)
    if false then
        return null
    endif
endfunction

function I2C takes integer i returns code
    return Code(I2CHelper(i))
endfunction

function C2IHelper takes code c returns integer
    call Code(i)
    if false then
        return 0
    endif
endfunction

function C2I takes code c returns integer
    return Integer(C2IHelper(c))
endfunction


Thanks, but I copied it to the custom code field of the worldedit and try to save the map, only get it to crash. Maybe I should copy it to war3map.j directly?
09-25-2009, 12:10 AM#7
azlier
I don't know. I would try that.

Note: PJass does not allow Return Nothing.
09-25-2009, 12:44 AM#8
Kathune
Thanks. But I use the offical worldedit.
09-25-2009, 03:22 AM#9
Strilanc
Quote:
Originally Posted by ToukoAozaki
Now Blizzard would need to introduce "not all code paths return a value" check. Would be an annoying task for them indeed.

Annoying?? More like "basic requirement for every compiler ever.".
09-25-2009, 03:24 AM#10
ToukoAozaki
Quote:
Originally Posted by Strilanc
Annoying?? More like "basic requirement for every compiler ever.".

Of course they are basic, but there weren't such "basic compiler making sense" in their product ever. And also, rewriting core features of a 8-year-old game is indeed a pain, regarding the game's current status.