Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -139,6 +139,7 @@ public class PNGImageReader extends ImageReader {
static final int tRNS_TYPE = 0x74524e53;
static final int zTXt_TYPE = 0x7a545874;

static final int MAX_INFLATED_TEXT_LENGTH = 262144;
static final int PNG_COLOR_GRAY = 0;
static final int PNG_COLOR_RGB = 2;
static final int PNG_COLOR_PALETTE = 3;
Expand Down Expand Up @@ -661,7 +662,7 @@ private void parse_tRNS_chunk(int chunkLength) throws IOException {
private static byte[] inflate(byte[] b) throws IOException {
InputStream bais = new ByteArrayInputStream(b);
try (InputStream iis = new InflaterInputStream(bais)) {
return iis.readAllBytes();
return iis.readNBytes(MAX_INFLATED_TEXT_LENGTH);
}
}

Expand Down