Viewing a single comment thread. View all comments

enderverse87 t1_itrdgs6 wrote

They aren't actually compressing something that already exists, they're creating a file that tricks the decompresser into creating a lot of files out of nowhere.

Like imagine you have instructions for creating a book, and the instructions read, "put a 1 on each page, and print a million pages"

You don't actually have to have an existing million page book to write those instructions, the decompresser/book maker will follow those instructions anyways. The (instructions for making a book/zip file) is really tiny, but the end result is huge.

40

philipjfry1578 t1_itrdtet wrote

So it's not possible to compress an already made file this small?

2

RhynoD t1_itreqyh wrote

It's not possible for an already made file like that to exist. Unzipped zip bombs can be many thousands of petabytes, which are themselves a thousand terabytes each. Most computers have a few terabytes of storage at most (which is the point of the zip bomb) and even if they did, unzipping files that big would potentially take years (also the point of the zip bomb).

If you started with an actual file to compress it would take up that much space and take that long to compress. You'd zip bomb yourself.

16

Partnumber t1_itrfukf wrote

At a very basic level, compression just takes the existing data and finds a shorter way of writing it. Let's say I had a list like:

Apple

Apple

Apple

Banana

I could compress the list, rewriting it as

3 Apple

1 Banana

And the same amount of data takes up less space. But it still takes up some amount of space. And the amount of space it takes up is directly related to the format of the list.

Apple

Apple

Banana

Apple

For instance would have to be compressed into

2 Apple

1 Banana

1 Apple

Which takes up more space, even compressed. So any meaningful data you have has a lower limit on how small it can be and still be useful. A zip bomb would be like sitting down and maliciously making a list that, when compressed, says

99999 Apple

The compression is very small but the output is very large.

TLDR: You can construct a file that compresses into a miniscule file size, but most real files that contain usable information won't.

11

enderverse87 t1_itreu8p wrote

Only if it's something simple, like you could compress an incredibly large blank white image down really tiny. And then you could edit the zip file to say there's actually a million of them in there.

But for the most part that's not going to work as well.

2