mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
7036144: GZIPInputStream readTrailer uses faulty available() test for end-of-stream
Reviewed-by: jpai
This commit is contained in:
parent
e5e7cd20ec
commit
d3f3011d56
2 changed files with 102 additions and 15 deletions
|
@ -237,23 +237,17 @@ public class GZIPInputStream extends InflaterInputStream {
|
|||
(readUInt(in) != (inf.getBytesWritten() & 0xffffffffL)))
|
||||
throw new ZipException("Corrupt GZIP trailer");
|
||||
|
||||
// If there are more bytes available in "in" or
|
||||
// the leftover in the "inf" is > 26 bytes:
|
||||
// this.trailer(8) + next.header.min(10) + next.trailer(8)
|
||||
// try concatenated case
|
||||
if (this.in.available() > 0 || n > 26) {
|
||||
int m = 8; // this.trailer
|
||||
try {
|
||||
m += readHeader(in); // next.header
|
||||
} catch (IOException ze) {
|
||||
return true; // ignore any malformed, do nothing
|
||||
}
|
||||
inf.reset();
|
||||
if (n > m)
|
||||
inf.setInput(buf, len - n + m, n - m);
|
||||
return false;
|
||||
int m = 8; // this.trailer
|
||||
try {
|
||||
m += readHeader(in); // next.header
|
||||
} catch (IOException ze) {
|
||||
return true; // ignore any malformed, do nothing
|
||||
}
|
||||
return true;
|
||||
inf.reset();
|
||||
if (n > m)
|
||||
inf.setInput(buf, len - n + m, n - m);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue