Skip to content

Commit

Permalink
fix for BMP/ICO magic detection
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3991 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jul 18, 2007
1 parent 557f8d8 commit cff0194
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion source/de/anomic/ymage/ymageBMPParser.java
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion source/de/anomic/ymage/ymageICOParser.java
Expand Up @@ -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) {
Expand Down

0 comments on commit cff0194

Please sign in to comment.