Ghidra is a software reverse engineering (SRE) framework
Ensure valid image width and height
Kai Bolayc03a07f9ef72
diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/png/IHDRChunk.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/png/IHDRChunk.javaindex 013244dd9e..1545b2b87e 100644--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/png/IHDRChunk.java+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/ios/png/IHDRChunk.java@@ -49,7 +49,13 @@ public class IHDRChunk {ByteBuffer buff = ByteBuffer.wrap(data);imgWidth = buff.getInt();+ if (imgWidth <= 0 || imgWidth > 65535) {+ throw new IllegalArgumentException("Invalid image width: " + imgWidth);+ }imgHeight = buff.getInt();+ if (imgHeight <= 0 || imgHeight > 65535) {+ throw new IllegalArgumentException("Invalid image height: " + imgHeight);+ }bitDepth = buff.get();colorType = buff.get();compressionMethod = buff.get();