Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix for BMP/ICO magic detection

orbitercff019464e26
diff --git a/source/de/anomic/ymage/ymageBMPParser.java b/source/de/anomic/ymage/ymageBMPParser.java
index 14ef88bdc..cd0c95708 100644
--- a/source/de/anomic/ymage/ymageBMPParser.java
+++ b/source/de/anomic/ymage/ymageBMPParser.java
@@ -52,7 +52,7 @@ public class ymageBMPParser {
public static final boolean isBMP(byte[] source) {
// check the file magic
- return (source[0] == 'B') && (source[1] == 'M');
+ return (source != null) && (source.length >= 2) && (source[0] == 'B') && (source[1] == 'M');
}
public ymageBMPParser(byte[] source) {
diff --git a/source/de/anomic/ymage/ymageICOParser.java b/source/de/anomic/ymage/ymageICOParser.java
index f69137c45..58472e753 100644
--- a/source/de/anomic/ymage/ymageICOParser.java
+++ b/source/de/anomic/ymage/ymageICOParser.java
@@ -44,7 +44,7 @@ public class ymageICOParser {
public static final boolean isICO(byte[] source) {
// check the file magic
- return (source[0] == 0) && (source[1] == 0) && (source[2] == 1) && (source[3] == 0);
+ return (source != null) && (source.length >= 4) && (source[0] == 0) && (source[1] == 0) && (source[2] == 1) && (source[3] == 0);
}
public ymageICOParser(byte[] source) {