summaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authordcommander <dcommander@3789f03b-4d11-0410-bbf8-ca57d06f2519>2012-06-07 09:38:57 +0000
committerdcommander <dcommander@3789f03b-4d11-0410-bbf8-ca57d06f2519>2012-06-07 09:38:57 +0000
commit15acb8ad2a3f44c61036bc1afcb8dee26d9d4796 (patch)
treef7b33da295cf514a9102030f019f65ccf0c50f9f /trunk
parenta97967781abd7c0c8a516f327c36d5cf34b6dfdc (diff)
Fix array size calculations
git-svn-id: https://libjpeg-turbo.svn.sourceforge.net/svnroot/libjpeg-turbo@833 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'trunk')
-rw-r--r--trunk/turbojpeg-jni.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/trunk/turbojpeg-jni.c b/trunk/turbojpeg-jni.c
index 3b9624a..c98845b 100644
--- a/trunk/turbojpeg-jni.c
+++ b/trunk/turbojpeg-jni.c
@@ -368,7 +368,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
if((*env)->GetArrayLength(env, src)<jpegSize)
_throw("Source buffer is not large enough");
actualPitch=(pitch==0)? width*tjPixelSize[pf]:pitch;
- arraySize=(y+height)*actualPitch + x*tjPixelSize[pf];
+ arraySize=(y+height-1)*actualPitch + (x+width)*tjPixelSize[pf];
if((*env)->GetArrayLength(env, dst)<arraySize)
_throw("Destination buffer is not large enough");
@@ -419,7 +419,7 @@ JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress
if((*env)->GetArrayLength(env, src)<jpegSize)
_throw("Source buffer is not large enough");
actualStride=(stride==0)? width:stride;
- arraySize=(y+height)*actualStride + x;
+ arraySize=(y+height-1)*actualStride + x+width;
if((*env)->GetArrayLength(env, dst)<arraySize)
_throw("Destination buffer is not large enough");