• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

return of return bug?

Status
Not open for further replies.
Level 23
Joined
Apr 16, 2012
Messages
4,041
I was curious, "now" that blizzard checks if branches, and if you dont have return in else branch, or outside of if code. However, they dont check return statement inside loop block, so code like

JASS:
function a takes nothing returns unit
     return null //some unit
endfunction

function b takes integer newA returns integer
    loop
        call a()
        exitwhen true
        return newA
    endloop
endfunction

function c takes nothing returns nothing
    call BJDebugMsg(I2S(b(5)))
endfunction

However, blizzard having at least a bit of foresight knew we would come up with another way to return bug, and they to make sure made it so that the thread crashes when the return statement is not reached at the end of function(even if a would return integer, it would still crash the thread).

This is nothing fancy, just thought I would share it
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
this is how return bug worked before, but instead of loop endloop block, there was if false then block. Basically, when you call function b, it says that it will return integer, but when you call function a, you return unit and how it used to work was that the last returned thing was not flushed, so if there was no return statement that was reachable inside b, you would return unit, but it would still be considered as integer(the interpreter does 0 type checks, the compiler does all the checkings) and it would work, because in Jass everything is of size 4 bytes
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Can you grab string table Ids with this? Because that thing was useful when we still had used the previous return bug exploit.
 
Status
Not open for further replies.
Top