Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala bomb? (like a zip bomb)

Please excuse the funny title, I am using it in analogy with "zip bomb". Is it possible to create a scala source file, that will, when compiled, produce a large number of class files (or a very large single class file)? Is there any way the size of the class files could grow faster than linearly with the size of the source file?

like image 639
Kim Stebel Avatar asked Dec 18 '11 11:12

Kim Stebel


People also ask

How can you tell if its a zip bomb?

Most modern antivirus programs can detect zip bombs by looking for overlapping files. They know not to unpack layer after layer of recursive data, which is a sign of a decompression bomb. Often, antivirus software labels a file a decompression bomb when it is not actually a bomb.

What are zip bombs?

In computing, a zip bomb, also known as a decompression bomb or zip of death, is a malicious archive file designed to crash or render useless the program or system reading it. It is often employed to disable antivirus software, in order to create an opening for more traditional malware.

How do you prevent zip bombs in Java?

Bomb Prevention Its quite easy to prevent a zip bomb from exploding… All you need to do is check the file's original size before writing it to disk. Set a limit to the uncompressed file sizes, or a deviation between the compressed and uncompressed sizes.


1 Answers

Specialization is inherently exponential in the number of type parameters specialized.

class Huge[@specialized A, @specialized B, @specialized C](   val a: A, val b: B, val c: C ) {} // 730 files, 2.9 MB  class Gigantic[@specialized A, @specialized B, @specialized C, @specialized D](   val a: A, val b: B, val c: C, val d: D ) {} // 6562 files, 26 MB 

Pattern matching can also involve a lot of code duplication for complex cases (though I find it difficult to predict exactly when this will occur).

like image 163
Rex Kerr Avatar answered Oct 04 '22 07:10

Rex Kerr