Skip to content

Commit

Permalink
Add check
Browse files Browse the repository at this point in the history
  • Loading branch information
flanglet committed Nov 25, 2023
1 parent f733b69 commit ae78b5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion java/src/main/java/kanzi/Magic.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ public class Magic
};


// 4 bytes must be available in 'src' at position 'start'
public static int getType(byte[] src, int start)
{
if (src.length < 4)
return NO_MAGIC;

final int key = Memory.BigEndian.readInt32(src, start);

if ((key & ~0x0F) == JPG_MAGIC)
Expand Down

0 comments on commit ae78b5f

Please sign in to comment.