8252739: Deflater.setDictionary(byte[], int off, int len) ignores the starting offset for the dictionary

Reviewed-by: uschindler, alanb
This commit is contained in:
Lance Andersen 2020-09-23 14:21:45 +00:00
parent 5f1d6120a5
commit 812b39f574
2 changed files with 253 additions and 1 deletions

View file

@ -105,7 +105,7 @@ Java_java_util_zip_Deflater_setDictionary(JNIEnv *env, jclass cls, jlong addr,
Bytef *buf = (*env)->GetPrimitiveArrayCritical(env, b, 0);
if (buf == NULL) /* out of memory */
return;
res = deflateSetDictionary(jlong_to_ptr(addr), buf, len);
res = deflateSetDictionary(jlong_to_ptr(addr), buf + off, len);
(*env)->ReleasePrimitiveArrayCritical(env, b, buf, 0);
checkSetDictionaryResult(env, addr, res);
}