What is the ILLegal bytecode?

While reading Java Security, I came across the suggestions below, but could not get a satisfactory explanation on the Internet. Can someone explain

  • Prevents class loading using bytecode
  • Prevents downloading into illegal packages
+3
source share
3 answers

However, we cannot be sure that the class itself is safe. There is still a SecurityManager that will prevent the class from accessing protected resources such as a network and local hard drive, but this is not enough. A class may contain invalid bytecode, forge pointers for protected memory, an overflow or overflow of the program stack, or in some other way distort the integrity of the JVM. Check topic Checking the class file in [1]: http://medialab.di.unipi.it/doc/JNetSec/jns_ch5.htm

+3
source

the byte code verifier performs the following checks:

  • Branches must be within the code array for the method.
  • . , , , , . .
  • , , , .
  • . : ldc int float String; getfield .
  • .
  • .
  • , , , , . . - , , .
+2

The source code is compiled into bytecode, which is distributed among users. If the bytecode was damaged or was not created by the java compiler, it may be illegal, which means that the bytes do not make sense.

0
source

Source: https://habr.com/ru/post/1723075/


All Articles