From a6612ab3ab8f17548497a8393428228d286d0b3a Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Sat, 3 Dec 2016 15:05:50 -0800 Subject: [PATCH] Exit instead of throwing in BERDecoder destructor; remove noexcept() stuff. --- src/cryptlib/asn.cpp | 8 ++++++-- src/cryptlib/asn.h | 2 +- src/cryptlib/cryptlib.h | 8 +------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/cryptlib/asn.cpp b/src/cryptlib/asn.cpp index cc6be88..f5e7989 100644 --- a/src/cryptlib/asn.cpp +++ b/src/cryptlib/asn.cpp @@ -81,13 +81,17 @@ BERSequenceDecoder::BERSequenceDecoder(BufferedTransformation &inQueue) definiteLength = BERLengthDecode(inQueue, length); } -BERSequenceDecoder::~BERSequenceDecoder() NOEXCEPT_FALSE +BERSequenceDecoder::~BERSequenceDecoder() { if (!definiteLength) { // remove end-of-content octects word16 i; if (!inQueue.GetShort(i) || (i!=0)) - BERDecodeError(); + { + fputs("### Internal Error.\n### Invalid or corrupt key.\n### Exiting...\n\ +", stderr); + exit(1); + } } } diff --git a/src/cryptlib/asn.h b/src/cryptlib/asn.h index f20b03f..13c18e1 100644 --- a/src/cryptlib/asn.h +++ b/src/cryptlib/asn.h @@ -25,7 +25,7 @@ class BERSequenceDecoder : public BufferedTransformation { public: BERSequenceDecoder(BufferedTransformation &inQueue); - ~BERSequenceDecoder() NOEXCEPT_FALSE; + ~BERSequenceDecoder(); void Put(byte) {} void Put(const byte *, unsigned int) {} diff --git a/src/cryptlib/cryptlib.h b/src/cryptlib/cryptlib.h index c23b367..145616f 100644 --- a/src/cryptlib/cryptlib.h +++ b/src/cryptlib/cryptlib.h @@ -10,12 +10,6 @@ #include #include -#if __cplusplus >= 201103L -# define NOEXCEPT_FALSE noexcept(false) -#else -# define NOEXCEPT_FALSE -#endif - /// base class for all exceptions thrown by Crypto++ class CryptlibException : public std::exception { @@ -204,7 +198,7 @@ class BufferedTransformation { public: /// - virtual ~BufferedTransformation() NOEXCEPT_FALSE {} + virtual ~BufferedTransformation() {} //@Man: INPUT //@{