-2

Actually I'm trying to study a code which is obfuscated with GOTO statements say..

private void fun()
{
if(somecondition)
    goto LABEL3;

...
...

LABEL3:
    return;
    Exception e;
    e;
    if(true) goto LABEL3; else LABEL7;


...
...

LABEL7:
    //some statements
}

and upon calling LABEL3 by the IF statement,
will function halt? LABEL7 will be called?
How the program would flow?

This is an decompiled java class file
decompiled class files where some statements are being replaced by goto ( for eg, WHILE with goto and IF combinations) for making them difficult to read.

EDIT

Becoz I assumed the decompiled class files would be completely inaccordance with java syntax, I posted this question but instead the decompilers used to generate pseudocodes often yet preserving few native syntax. Yes there isn't no goto but its just dummy keyword and yes LABEL3 could possibly return and others unreachable.

everlasto
  • 4,890
  • 4
  • 24
  • 31

2 Answers2

3

This piece of code looks like the output of jad when it is not able to fully decompile the .class

If that's the case, check for errors (in java comments at the end of the class file). It will probably have some regarding the code block you posted.

richardtz
  • 4,993
  • 2
  • 27
  • 38
  • yes actually they didn't generate java source code but pseudocode.. and there isn't any error logs, nothing .. – everlasto Dec 21 '12 at 10:17
  • you should look at comments in the source code at the end of the java file, referencing errors while decompiling. It usually happens with static blocks or static declarations. – richardtz Dec 21 '12 at 10:31
  • I forgot to mention it always happens when decompiling synchronized blocks. – richardtz Dec 21 '12 at 12:11
1

If the condition if(somecondition) holds, the function will exit. Thus, LABEL7 will not be called. return should mean "return from the function" and not return from the goto-block. At least if Java (or other language, as from comment is does not seem Java) did not change the usual definition of goto and return.

Actually, I am wondering what all this stuff after return; is for. It should never get called, as there is no other entry point after return (label).

aufziehvogel
  • 7,167
  • 5
  • 34
  • 56