Merge pull request #779 from twiss/throw-parse-errors

Throw on parse errors in integrity protected encrypted packets
This commit is contained in:
Sanjana Rajan 2018-10-10 18:16:59 +02:00 committed by GitHub
commit 1e3f223e8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -53,10 +53,9 @@ List.prototype.read = async function (bytes) {
await packet.read(parsed.packet);
await writer.write(packet);
} catch (e) {
if (!config.tolerant ||
parsed.tag === enums.packet.symmetricallyEncrypted ||
parsed.tag === enums.packet.literal ||
parsed.tag === enums.packet.compressed) {
if (!config.tolerant || packetParser.supportsStreaming(parsed.tag)) {
// The packets that support streaming also happen to be the same
// ones we want to throw on parse errors for.
await writer.abort(e);
}
util.print_debug_error(e);