mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 19:14:55 +00:00
Limit number of bytes for filename encoding detection
This commit is contained in:
parent
2b768d7c9f
commit
8e01b23e3c
@ -808,16 +808,23 @@ class SevenZipExtractor {
|
||||
return unpackSuccessful;
|
||||
}
|
||||
|
||||
private Charset detectFilenamesCharset(Collection<byte[]> byteDatas) {
|
||||
private Charset detectFilenamesCharset(ArrayList<byte[]> byteDatas) {
|
||||
Charset detectedCharset = null;
|
||||
CharsetDetector charsetDetector = new CharsetDetector();
|
||||
int sum = 0;
|
||||
int byteSum = 0;
|
||||
int fileNum = 0;
|
||||
for (byte[] byteData : byteDatas) {
|
||||
sum += byteData.length;
|
||||
fileNum++;
|
||||
byteSum += byteData.length;
|
||||
// Only read ~1000 bytes of filenames in this directory
|
||||
if (byteSum >= 1000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
byte[] allBytes = new byte[sum];
|
||||
byte[] allBytes = new byte[byteSum];
|
||||
int start = 0;
|
||||
for (byte[] byteData : byteDatas) {
|
||||
for (int i = 0; i < fileNum; i++) {
|
||||
byte[] byteData = byteDatas.get(i);
|
||||
System.arraycopy(byteData, 0, allBytes, start, byteData.length);
|
||||
start += byteData.length;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user