public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gcj at stuellenberg dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug java/14446] New: GZIPInputStream: corrupted gzip file - crc mismatch Date: Fri, 05 Mar 2004 09:27:00 -0000 [thread overview] Message-ID: <20040305092750.14446.gcj@stuellenberg.de> (raw) Using the GZIPInputStream I found out, that "sometimes" but not always the following exception gets thrown (I've attached a file that causes the error): java.util.zip.ZipException: corrupted gzip file - crc mismatch So, you might use GZIPOutputStream to compress and then while decompressing the error gets thrown. I'm going to attach a small jar, that you might use to test. java -jar zipper.jar compress test-document test-compressed java -jar zipper.jar uncompress test-compressed test-uncompressed Java version works without any problems... gcj --main=com.condor_edv.e3m.util.compress.fun -o zipper zipper.jar zipper compress test-document test-compressed zipper uncompress test-compressed test-uncompressed throws the error... The source for the zipper.jar is compiled through nice (nice.sf.net) but it only contains the following: class CompressTest { public void deflate(InputStream in, OutputStream out) { byte[] ba = new byte[buffersize]; int b, count = 0; GZIPOutputStream gout = new GZIPOutputStream(out); try { while (true) { b = in.read(); if (b == -1) throw new EOFException(); ba[count++] = byte(b); if (count == buffersize) { count = 0; gout.write(ba, 0, buffersize); } } } catch (EOFException eof) { } gout.write(ba, 0, count); gout.finish(); } public void inflate(InputStream in, OutputStream out) { byte[] ba = new byte[buffersize]; int b, count = 0; GZIPInputStream gin = new GZIPInputStream(in); try { while (true) { b = gin.read(); if (b == -1) throw new EOFException(); ba[count++] = byte(b); if (count == buffersize) { count = 0; out.write(ba, 0, buffersize); } } } catch (EOFException eof) { } out.write(ba, 0, count); out.flush(); } } void main(String[] args) { try { if (args.length == 3) { CompressTest c = new CompressTest(); // ok, let us convert some files // (load|save) in out FileInputStream in = new FileInputStream(args[1]); FileOutputStream out = new FileOutputStream(args[2]); if (args[0].equals("compress")) { c.deflate(in, out); } else if (args[0].equals("uncompress")) { c.inflate(in, out); } else System.out.println("Unknown Action: "+args[0]); in.close(); out.close(); } else { System.out.println("Unsupported Action!"); } } catch (Exception e) { e.printStackTrace(); } } Hopefully someone can reproduce the bug... Kind regards, Christian -- Summary: GZIPInputStream: corrupted gzip file - crc mismatch Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: gcj at stuellenberg dot de CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: i586-pc-linux-gnu GCC host triplet: i586-pc-linux-gnu GCC target triplet: i586-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14446
next reply other threads:[~2004-03-05 9:27 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-03-05 9:27 gcj at stuellenberg dot de [this message] 2004-03-05 9:30 ` [Bug java/14446] " gcj at stuellenberg dot de 2004-03-05 9:31 ` gcj at stuellenberg dot de 2004-09-22 16:02 ` sorabain at hotmail dot com 2004-09-22 19:27 ` tromey at gcc dot gnu dot org 2004-09-22 19:42 ` tromey at gcc dot gnu dot org 2004-09-22 20:16 ` cvs-commit at gcc dot gnu dot org 2004-09-22 20:17 ` tromey at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040305092750.14446.gcj@stuellenberg.de \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).