mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 14:56:19 -04:00
Fix magic library to better handle operation error
This commit is contained in:
parent
bb7487c476
commit
4fafa39e54
1 changed files with 11 additions and 1 deletions
|
@ -312,6 +312,11 @@ class Magic {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the recipe returned an empty buffer, do not continue
|
||||||
|
if (_buffersEqual(output, new ArrayBuffer())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const magic = new Magic(output, this.opPatterns),
|
const magic = new Magic(output, this.opPatterns),
|
||||||
speculativeResults = await magic.speculativeExecution(
|
speculativeResults = await magic.speculativeExecution(
|
||||||
depth-1, extLang, intensive, [...recipeConfig, opConfig], op.useful, crib);
|
depth-1, extLang, intensive, [...recipeConfig, opConfig], op.useful, crib);
|
||||||
|
@ -395,7 +400,12 @@ class Magic {
|
||||||
const recipe = new Recipe(recipeConfig);
|
const recipe = new Recipe(recipeConfig);
|
||||||
try {
|
try {
|
||||||
await recipe.execute(dish);
|
await recipe.execute(dish);
|
||||||
|
// Return an empty buffer if the recipe did not run to completion
|
||||||
|
if (recipe.lastRunOp === recipe.opList[recipe.opList.length - 1]) {
|
||||||
return dish.get(Dish.ARRAY_BUFFER);
|
return dish.get(Dish.ARRAY_BUFFER);
|
||||||
|
} else {
|
||||||
|
return new ArrayBuffer();
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// If there are errors, return an empty buffer
|
// If there are errors, return an empty buffer
|
||||||
return new ArrayBuffer();
|
return new ArrayBuffer();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue