format or another compression format that
decompresses to itself. I've made one, the direct
link is:
http://www.beautiful-weddings.com/caspian/selfgz.gz
(The domain's for my mum's website) and there is
an index page with links to notes about it at:
http://caspian.arts-centre.net/
Treating gzip files as a programs that output the
result, here is the pseudocode with code addresses
and output addresses:
addr pseudocode output
000: begin
010: unc(15)
015: begin ;0
025: unc(15) ;10
030: nop10
040: copy(8,15),(7,15), unc(30) ;15,25
050: nop10 ;30
060: copy(8,15),(7,15), unc(30) ;40
070: nop10 ;50
080: nop10
090: nop10
100: copy(20,20),(10,10), unc(20) ;60,70,80
110: nop10 ;90
120: copy(20,20),(10,10), unc(20) ;100
130: copy(20,20),(10,10), unc(20) ;110,120,130
140: data-for-crc ;140
150: copy(5,10),(5,10), unc(20) ;150
160: copy(5,10),(5,10), unc(20) ;160
170: copy(10,20),(10,20), unc(0) ;170
180: end ;180
190: copy(10,20),(10,20), unc(0) ;190,200
200: end
210:
unc(n) is a header for n uncompressed bytes.
copy(length, dist) repeats "length" bytes from a
position starting "dist" bytes before the new
copy.
nop10 outputs nothing.
--
Caspian Maclean
> Hi, there have been some discussions in the past
> about whether it's possible to have a file in gzip
> format or another compression format that
> decompresses to itself. I've made one,
bash-2.05b$ wget http://www.beautiful-weddings.com/caspian/selfgz.gz
bash-2.05b$ cp selfgz.gz selfgz2.gz
bash-2.05b$ gunzip selfgz2.gz
bash-2.05b$ cmp selfgz.gz selfgz2
Brilliant!
I tried and failed myself. I was hoping that an iterative approach
would work, a la Floyd, but it didn't.
Hearty congratulations!
Phil
--
1st bug in MS win2k source code found after 20 minutes: scanline.cpp
2nd and 3rd bug found after 10 more minutes: gethost.c
Both non-exploitable. (The 2nd/3rd ones might be, depending on the CRTL)
This is very clever. I like it. I've seen something similar done with a C
program that prints itself.
I wonder what the shortest such file is. An empty .gz file will
"uncompress" to itself but that doesn't really count since you get an error
message and the .gz extension isn't removed.
-- Matt Mahoney
Most impressive! selfgz.gz is exactly what you say it is. I didn't
think it was possible. Good job.
mark
Kudos!
That is cool as all hell, and much more intellectually interesting
than the recent summer run of quacks.
--
Sev
Wow! Maclean rules.
> Hi, there have been some discussions in the past
> about whether it's possible to have a file in gzip
> format or another compression format that
> decompresses to itself. I've made one, the direct
> link is:
> http://www.beautiful-weddings.com/caspian/selfgz.gz
Nice piece of work!
Thought when we have this, can you make a second version, which includes
the filename. It seems some extractors require the extracted file to have
extension .gz to detect it as gzip again. This file could be a stress
tester for virus checkers then, as detection of these large gain 4GB files
is much easier than detection of your little beast. I will need updating
my Amiga virus checker as well ;-)
Ciao
--
____ _ _ ____ _ _ _ _ ____
| | | | | | \ / | | | the cool Gremlin from Bischofswerda
| __ | ____| | \/ | | | WWW: http://www.dstoecker.de/
| | | | | | | | PGP key available on www page.
|____| _|_ |____| _|_ _|_ |____| I hope AMIGA never stops making fun!
Wow! Amiga? Is there still a community? (I gave up all the hope 3 years ago)
Re.
> Hi,
>> Hi, there have been some discussions in the past
>> about whether it's possible to have a file in gzip
>> format or another compression format that
>> decompresses to itself. I've made one, the direct
>> link is:
>> http://www.beautiful-weddings.com/caspian/selfgz.gz
> Nice piece of work!
Thanks to everyone for all the encouragement.
> Thought when we have this, can you make a second version, which
> includes the filename. It seems some extractors require the extracted
> file to have extension .gz to detect it as gzip again. This file could
> be a stress tester for virus checkers then, as detection of these
> large gain 4GB files is much easier than detection of your little
> beast. I will need updating my Amiga virus checker as well ;-)
Good idea, but I don't want to spend much time on it right away.
I might do that eventually if no one else does first. It's quite
simple in theory, but the helper programs I used were on a hard
disk that failed, and I haven't set up a new working linux system
to run them on yet. Solving the checksum by hand in particular
would be very tedious.
> Ciao
--
Caspian Maclean
> Wow! Amiga? Is there still a community? (I gave up all the hope 3 years ago)
Well, smaller than an epsilon that tends to zero. There are still some
die-hards like Dirk (that's not supposed to sound negative, Dirk.)
I personally gave up around two years ago when my system broke down.
So long,
Thomas