title: get the filesize of very large .gz file on a 64bit platform
body: <p>According to the specifiction of gz the filesize is saved in the last 4bytes of a .gz file.</p>
  
  <p>I have created 2 files with</p>
  
  <pre><code>dd if=/dev/urandom of=500M bs=1024 count=500000
  dd if=/dev/urandom of=5G bs=1024 count=5000000
  </code></pre>
  
  <p>I gziped them</p>
  
  <pre><code>gzip 500M 5G
  </code></pre>
  
  <p>I checked the last 4 bytes doing</p>
  
  <pre><code>tail -c4 500M|od -I      (returns 512000000 as expected)
  tail -c4 5G|od -I        (returns 825032704 as not expected)
  </code></pre>
  
  <p>It seems that hitting the invisible 32bit barrier, makes the value written into the ISIZE completely nonsense. Which is more annoying, than if they had used some error bit instead.</p>
  
  <p>Does anyone know of a way to get the uncompressed .gz filesize from the .gz without extracting it?</p>
  
  <p>thanks</p>
  
  <p>specification: <a href="http://www.gzip.org/zlib/rfc-gzip.html" rel="noreferrer">http://www.gzip.org/zlib/rfc-gzip.html</a></p>
  
  <p>edit:
  if anyone to try it out, you could use /dev/zero instead of /dev/urandom</p>