Check for invalid subsampling factor
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@433 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
index 08d0bbd..9cd2fe6 100644
--- a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
+++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
@@ -65,6 +65,8 @@
public int getSubsamp() throws Exception {
if(jpegSubsamp < 0) throw new Exception("JPEG buffer not initialized");
+ if(jpegSubsamp >= TJ.NUMSAMPOPT)
+ throw new Exception("JPEG header information is invalid");
return jpegSubsamp;
}