Closed MsDidin closed 1 year ago
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) C [libzstd-jni.so] Java_com_github_luben_zstd_Zstd_decompress Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j com.github.luben.zstd.Zstd.decompress
#10 in **jni_GetArrayLength** () from libjvm.so
JNIEXPORT jlong JNICALL Java_com_github_luben_zstd_Zstd_decompress (JNIEnv *env, jclass obj, jbyteArray dst, jbyteArray src) { size_t size = (size_t)(0-ZSTD_error_memory_allocation); jsize dst_size = (*env)->GetArrayLength(env, dst); jsize src_size = (*env)->GetArrayLength(env, src); void *dst_buff = (*env)->GetPrimitiveArrayCritical(env, dst, NULL); if (dst_buff == NULL) goto E1; void *src_buff = (*env)->GetPrimitiveArrayCritical(env, src, NULL); if (src_buff == NULL) goto E2; size = ZSTD_decompress(dst_buff, (size_t) dst_size, src_buff, (size_t) src_size); (*env)->ReleasePrimitiveArrayCritical(env, src, src_buff, JNI_ABORT); E2: (*env)->ReleasePrimitiveArrayCritical(env, dst, dst_buff, 0); E1: return size; }
Do you have any idea why this crash occurred ? And I have noticed that function Java_com_github_luben_zstd_Zstd_decompress is deleted in the latest master version, is there any reason this function not supported ?
I will close this issue since crash caused by passing null array to native code.
zstd-jni version: 1.3.7-1
java pid error:
gdb bt command for core dump file:
I found the crash point in jni implementation code(tag 1.3.7-1):
Do you have any idea why this crash occurred ? And I have noticed that function Java_com_github_luben_zstd_Zstd_decompress is deleted in the latest master version, is there any reason this function not supported ?