Skip to content

Commit

Permalink
Merge pull request #101 from ditgittube/release_1.3.15
Browse files Browse the repository at this point in the history
Remove lz4 to fix CVE-2021-3520
  • Loading branch information
zliangg authored Sep 20, 2022
2 parents fc7527e + 5e9488d commit 05a6d15
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 157 deletions.
12 changes: 0 additions & 12 deletions huaweicloud-sdk-java-dis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@
<version>${jackson.version}</version>
</dependency>

<!--<dependency>
<groupId>net.jpountz.lz4</groupId>
<artifactId>lz4</artifactId>
<version>1.3.0</version>
</dependency>-->

<dependency>
<groupId>org.lz4</groupId>
<artifactId>lz4-java</artifactId>
<version>1.8.0</version>
</dependency>

<dependency>
<groupId>com.github.luben</groupId>
<artifactId>zstd-jni</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,10 @@ public interface Constants
*/
String CACHE_ARCHIVE_INDEX_FILE_SUFFIX = ".index";
/****************************** Local Data Cache End ******************************/

String COMPRESS_LZ4 = "lz4";

String COMPRESS_SNAPPY = "snappy";

String COMPRESS_ZSTD = "zstd";

String COMPRESS_LZ4_CONTENT_LENGTH = "x-dis-lz4-content-length";

String COMPRESS_ZSTD_CONTENT_LENGTH = "x-dis-zstd-content-length";

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.huaweicloud.dis.iface.data.request.PutRecordsRequestEntry;
import com.huaweicloud.dis.iface.data.response.*;
import com.huaweicloud.dis.util.*;
import com.huaweicloud.dis.util.compress.Lz4Util;
import com.huaweicloud.dis.util.compress.ZstdUtil;
import com.huaweicloud.dis.util.config.ICredentialsProvider;
import com.huaweicloud.dis.util.encrypt.EncryptUtils;
Expand Down Expand Up @@ -252,15 +251,10 @@ private byte[] compressBody(Request<HttpRequest> request, byte[] source) {
return source;
}

String compressType = disConfig.get(DISConfig.PROPERTY_BODY_COMPRESS_TYPE, Constants.COMPRESS_LZ4);
String compressType = disConfig.get(DISConfig.PROPERTY_BODY_COMPRESS_TYPE, Constants.COMPRESS_ZSTD);

byte[] target = null;
if (Constants.COMPRESS_LZ4.equals(compressType)) {
request.addHeader("Content-Encoding", Constants.COMPRESS_LZ4);
request.addHeader("Accept-Encoding", Constants.COMPRESS_LZ4);
request.addHeader(Constants.COMPRESS_LZ4_CONTENT_LENGTH, String.valueOf(source.length));
target = Lz4Util.compressByte(source);
} else if (Constants.COMPRESS_SNAPPY.equals(compressType)) {
if (Constants.COMPRESS_SNAPPY.equals(compressType)) {
request.addHeader("Content-Encoding", Constants.COMPRESS_SNAPPY);
request.addHeader("Accept-Encoding", Constants.COMPRESS_SNAPPY);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@
* 上传数据到 DIS 时,选择的压缩算法。
*/
public enum CompressionType {

/**
* LZ4 算法 - 综合来看效率最高的压缩算法,更加侧重压缩解压速度,压缩比并不是第一。
*/
LZ4("lz4"),

/**
/**Ωƒ
* SNAPPY 算法 - 其目标不是最大限度压缩或者兼容其他压缩格式,而是旨在提供高速压缩速度和合理的压缩率。
*/
SNAPPY("snappy"),
Expand Down

This file was deleted.

0 comments on commit 05a6d15

Please sign in to comment.