From cba1ecce8a07ebdb80cdd7d43e092d3309a0da27 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 25 Jul 2018 14:35:51 -0500 Subject: [PATCH] Do not rely on asserts for behaviour Closes #35 --- lib/openpgp.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/openpgp.php b/lib/openpgp.php index dc659d7..565f09b 100644 --- a/lib/openpgp.php +++ b/lib/openpgp.php @@ -685,7 +685,9 @@ class OpenPGP_SignaturePacket extends OpenPGP_Packet { switch($this->version = ord($this->read_byte())) { case 2: case 3: - assert(ord($this->read_byte()) == 5); + if(ord($this->read_byte()) != 5) { + throw new Exception("Invalid version 2 or 3 SignaturePacket"); + } $this->signature_type = ord($this->read_byte()); $creation_time = $this->read_timestamp(); $keyid = $this->read_bytes(8);