HADOOP-8151. Error handling in snappy decompressor throws invalid exceptions. Contributed by Matt Foley. (harsh)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1389006 13f79535-47bb-0310-9956-ffa450edef68 (cherry picked from commitac31d6a448
) Conflicts: hadoop-common-project/hadoop-common/CHANGES.txt (cherry picked from commit55427fb66c
)
This commit is contained in:
parent
f21fb808f1
commit
34739fc91e
|
@ -66,6 +66,9 @@ Release 2.6.1 - UNRELEASED
|
||||||
HADOOP-11491. HarFs incorrectly declared as requiring an authority.
|
HADOOP-11491. HarFs incorrectly declared as requiring an authority.
|
||||||
(Brahma Reddy Battula via gera)
|
(Brahma Reddy Battula via gera)
|
||||||
|
|
||||||
|
HADOOP-8151. Error handling in snappy decompressor throws invalid
|
||||||
|
exceptions. (Matt Foley via harsh)
|
||||||
|
|
||||||
Release 2.6.0 - 2014-11-18
|
Release 2.6.0 - 2014-11-18
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -83,7 +83,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_comp
|
||||||
|
|
||||||
compressed_direct_buf_len = LZ4_compress(uncompressed_bytes, compressed_bytes, uncompressed_direct_buf_len);
|
compressed_direct_buf_len = LZ4_compress(uncompressed_bytes, compressed_bytes, uncompressed_direct_buf_len);
|
||||||
if (compressed_direct_buf_len < 0){
|
if (compressed_direct_buf_len < 0){
|
||||||
THROW(env, "Ljava/lang/InternalError", "LZ4_compress failed");
|
THROW(env, "java/lang/InternalError", "LZ4_compress failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
(*env)->SetIntField(env, thisj, Lz4Compressor_uncompressedDirectBufLen, 0);
|
(*env)->SetIntField(env, thisj, Lz4Compressor_uncompressedDirectBufLen, 0);
|
||||||
|
|
|
@ -80,7 +80,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Decompressor_de
|
||||||
|
|
||||||
uncompressed_direct_buf_len = LZ4_decompress_safe(compressed_bytes, uncompressed_bytes, compressed_direct_buf_len, uncompressed_direct_buf_len);
|
uncompressed_direct_buf_len = LZ4_decompress_safe(compressed_bytes, uncompressed_bytes, compressed_direct_buf_len, uncompressed_direct_buf_len);
|
||||||
if (uncompressed_direct_buf_len < 0) {
|
if (uncompressed_direct_buf_len < 0) {
|
||||||
THROW(env, "Ljava/lang/InternalError", "LZ4_uncompress_unknownOutputSize failed.");
|
THROW(env, "java/lang/InternalError", "LZ4_uncompress_unknownOutputSize failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
(*env)->SetIntField(env, thisj, Lz4Decompressor_compressedDirectBufLen, 0);
|
(*env)->SetIntField(env, thisj, Lz4Decompressor_compressedDirectBufLen, 0);
|
||||||
|
|
|
@ -134,11 +134,11 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_snappy_SnappyCompresso
|
||||||
ret = dlsym_snappy_compress(uncompressed_bytes, uncompressed_direct_buf_len,
|
ret = dlsym_snappy_compress(uncompressed_bytes, uncompressed_direct_buf_len,
|
||||||
compressed_bytes, &buf_len);
|
compressed_bytes, &buf_len);
|
||||||
if (ret != SNAPPY_OK){
|
if (ret != SNAPPY_OK){
|
||||||
THROW(env, "Ljava/lang/InternalError", "Could not compress data. Buffer length is too small.");
|
THROW(env, "java/lang/InternalError", "Could not compress data. Buffer length is too small.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (buf_len > JINT_MAX) {
|
if (buf_len > JINT_MAX) {
|
||||||
THROW(env, "Ljava/lang/InternalError", "Invalid return buffer length.");
|
THROW(env, "java/lang/InternalError", "Invalid return buffer length.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,11 +126,11 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_snappy_SnappyDecompres
|
||||||
ret = dlsym_snappy_uncompress(compressed_bytes, compressed_direct_buf_len,
|
ret = dlsym_snappy_uncompress(compressed_bytes, compressed_direct_buf_len,
|
||||||
uncompressed_bytes, &uncompressed_direct_buf_len);
|
uncompressed_bytes, &uncompressed_direct_buf_len);
|
||||||
if (ret == SNAPPY_BUFFER_TOO_SMALL){
|
if (ret == SNAPPY_BUFFER_TOO_SMALL){
|
||||||
THROW(env, "Ljava/lang/InternalError", "Could not decompress data. Buffer length is too small.");
|
THROW(env, "java/lang/InternalError", "Could not decompress data. Buffer length is too small.");
|
||||||
} else if (ret == SNAPPY_INVALID_INPUT){
|
} else if (ret == SNAPPY_INVALID_INPUT){
|
||||||
THROW(env, "Ljava/lang/InternalError", "Could not decompress data. Input is invalid.");
|
THROW(env, "java/lang/InternalError", "Could not decompress data. Input is invalid.");
|
||||||
} else if (ret != SNAPPY_OK){
|
} else if (ret != SNAPPY_OK){
|
||||||
THROW(env, "Ljava/lang/InternalError", "Could not decompress data.");
|
THROW(env, "java/lang/InternalError", "Could not decompress data.");
|
||||||
}
|
}
|
||||||
|
|
||||||
(*env)->SetIntField(env, thisj, SnappyDecompressor_compressedDirectBufLen, 0);
|
(*env)->SetIntField(env, thisj, SnappyDecompressor_compressedDirectBufLen, 0);
|
||||||
|
|
Loading…
Reference in New Issue