-
Notifications
You must be signed in to change notification settings - Fork 185
Closed
Description
Hello! I caught a problem while using your library.
I uploaded the problematic file named buildings.zip, because GitHub forbid to load file with extension .zstd. It is just a compressed binary file, not an archive. Python built-in module can decompress it, as far as original C library. So, the problem occured only in zstd-jni. I used latest version of the library (v1.5.7-3) from maven repo. Windows and macOS both have the same problem with this file.
Caught Exception:
com.github.luben.zstd.ZstdException: Src size is incorrect
at com.github.luben.zstd.ZstdDecompressCtx.decompressByteArray(ZstdDecompressCtx.java:224)
at com.github.luben.zstd.ZstdDecompressCtx.decompress(ZstdDecompressCtx.java:356)
at com.github.luben.zstd.ZstdDecompressCtx.decompress(ZstdDecompressCtx.java:373)
at com.github.luben.zstd.Zstd.decompress(Zstd.java:1323)
at dev.donutquine.swf.file.compression.Zstandard.decompress(Zstandard.java:24)
at dev.donutquine.swf.file.compression.Zstandard.decompress(Zstandard.java:10)
package dev.donutquine.swf.file.compression;
import com.github.luben.zstd.Zstd;
public final class Zstandard {
private Zstandard() {
}
public static byte[] decompress(byte[] compressedData, int offset) {
return decompress(compressedData, offset, compressedData.length - offset);
}
public static byte[] decompress(byte[] compressedData, int offset, int length) {
int decompressedSize = (int) Zstd.getFrameContentSize(compressedData, offset, length);
byte[] zstdContent;
if (offset > 0 || length != compressedData.length - offset) {
zstdContent = new byte[length];
System.arraycopy(compressedData, offset, zstdContent, 0, zstdContent.length);
} else {
zstdContent = compressedData;
}
return Zstd.decompress(
zstdContent,
decompressedSize
);
}
public static byte[] compress(byte[] data) {
return Zstd.compress(data);
}
}
Metadata
Metadata
Assignees
Labels
No labels