• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

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
 
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
 
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.
Back
Top