fix for BMP/ICO magic detection

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3991 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 18 years ago
parent 557f8d80e4
commit cff019464e

@ -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) {

@ -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) {

Loading…
Cancel
Save