mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Merge branch 'master' of https://github.com/XlogicX/CyberChef
This commit is contained in:
commit
32e7dd030e
1 changed files with 0 additions and 19 deletions
|
@ -7,7 +7,6 @@
|
||||||
import Operation from "../Operation.mjs";
|
import Operation from "../Operation.mjs";
|
||||||
import {INFLATE_BUFFER_TYPE} from "../lib/Zlib.mjs";
|
import {INFLATE_BUFFER_TYPE} from "../lib/Zlib.mjs";
|
||||||
import rawinflate from "zlibjs/bin/rawinflate.min.js";
|
import rawinflate from "zlibjs/bin/rawinflate.min.js";
|
||||||
import OperationError from "../errors/OperationError.mjs";
|
|
||||||
|
|
||||||
const Zlib = rawinflate.Zlib;
|
const Zlib = rawinflate.Zlib;
|
||||||
|
|
||||||
|
@ -83,24 +82,6 @@ class RawInflate extends Operation {
|
||||||
}),
|
}),
|
||||||
result = new Uint8Array(inflate.decompress());
|
result = new Uint8Array(inflate.decompress());
|
||||||
|
|
||||||
// Raw Inflate sometimes messes up and returns nonsense like this:
|
|
||||||
// ]....]....]....]....]....]....]....]....]....]....]....]....]....]...
|
|
||||||
// e.g. Input data of [8b, 1d, dc, 44]
|
|
||||||
// Look for the first two square brackets:
|
|
||||||
if (result.length > 158 && result[0] === 93 && result[5] === 93) {
|
|
||||||
// If the first two square brackets are there, check that the others
|
|
||||||
// are also there. If they are, throw an error. If not, continue.
|
|
||||||
let valid = false;
|
|
||||||
for (let i = 0; i < 155; i += 5) {
|
|
||||||
if (result[i] !== 93) {
|
|
||||||
valid = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!valid) {
|
|
||||||
throw new OperationError("Error: Unable to inflate data");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// This seems to be the easiest way...
|
// This seems to be the easiest way...
|
||||||
return result.buffer;
|
return result.buffer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue