mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8347911: Limit the length of inflated text chunks
Reviewed-by: andrew
Backport-of: 398a580518
This commit is contained in:
committed by
Sergey Shelomentsev
parent
9aa750cf29
commit
06a7d486af
@@ -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
|
||||
@@ -142,6 +142,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;
|
||||
@@ -670,7 +671,7 @@ public class PNGImageReader extends ImageReader {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user