Verified Commit 7aecfb33 authored by Samuel Elliott's avatar Samuel Elliott
Browse files

Fail when a message has no payloads

parent 3506cdd1
Pipeline #795 failed with stages
in 1 minute and 39 seconds
......@@ -285,6 +285,10 @@ export class DecryptStream extends Transform {
this.push(this.last_payload.decrypt(this.header, this.recipient, this.payload_key, this.payload_index));
}
if (!this.last_payload) {
throw new Error('No encrypted payloads, message truncated?');
}
} catch (err) {
return callback(err);
}
......
......@@ -129,6 +129,10 @@ export async function verify(signed: Uint8Array, public_key: Uint8Array): Promis
output = Buffer.concat([output, payload.data]);
}
if (!items.length) {
throw new Error('No signed payloads, message truncated?');
}
return output;
}
......@@ -204,6 +208,10 @@ export class VerifyStream extends Transform {
this.push(this.last_payload.data);
}
if (!this.last_payload) {
throw new Error('No signed payloads, message truncated?');
}
} catch (err) {
return callback(err);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment