• 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.

[JASS] Return Bug

Status
Not open for further replies.
Level 8
Joined
Nov 9, 2008
Messages
502
Hey, I've had a break from editing and it was conveniently over the period that 1.24 was released.

Release notes talk about false positives (the return bug) and I'm not too sure about this.

I heard somewhere that basicly you can't use 2 returns in one function. Can someone clarify what I need to change in my map to get it working again?

I didn't even know I'd used any return bug and I haven't used any handle functions so I'm at a loss at what I need to fix.

Please?
Thanks :>
 
Hey, I've had a break from editing and it was conveniently over the period that 1.24 was released.

Release notes talk about false positives (the return bug) and I'm not too sure about this.

I heard somewhere that basicly you can't use 2 returns in one function. Can someone clarify what I need to change in my map to get it working again?

I didn't even know I'd used any return bug and I haven't used any handle functions so I'm at a loss at what I need to fix.

Please?
Thanks :>

dont know anything bout this but I read in the 1.24b patch note that this bug is already fixed..
 
(according to what I know...)
The return bug:
JASS:
function H2I takes handle h returns integer
     return h
     return 0
endfunction
would allow a JASSer to return a unique integer ID from a handle.
It also allowed you to execute Bytecode from the map (don't ask me how. I have no idea...), which allowed a lot of pretty awesome things, but also made bad things (virus maps).

The newest patch has made it so the return bug isn't possible, but we can still get the handle ID with something like:
JASS:
function H2I takes handle h returns integer
     return GetHandleId(h) // GetHandleId() is a new native, which will take a handle, and return it's integer ID.
endfunction
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
The return bug is typecasting in a function to get either an ID of a handle (very commonly used), the handle of an ID, or just bullshit like Location2Real (I have seriously seen that once, for some save/load thing).
Typecasting means you return an other type of variable (integer, real, handle,widget) than is behind the "returns".
Though this shouldnt be possible, it was because only the last 'return' was type-safe.
Because of this, in any return before that one you could return whatever you wanted.
Like this:
JASS:
 function H2I takes handle h returns integer
    return h
    return 0
endfunction
h is no integer, but still this compiles, for only the last return is type-safe and 0 is an integer. That is how typecasting, A.K.A. the return bug works. Blizzard did some things to solve this, but i am not sure wether it is already fully fixed or if there are still workarounds. Either way, a virus could be generated by returning code (returns code, and do some shit with it, due to this, returning code isnt possible at all anymore. The map will not run if code is returned, or if there is a return bug used.
 
Level 8
Joined
Nov 9, 2008
Messages
502
Oh that's hax0r lol

So my problem is definately not to do with typecasting.

I haven't updated JNGP or anything since new patch. Is there an update? Maybe this is what is causing me to get "map not found" when I try to open it in warcraft.
 
Status
Not open for further replies.
Top