aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-11-22 14:27:35 +0100
committerPierre Ossman <ossman@cendio.se>2024-11-22 14:27:35 +0100
commit213c12c4f12101b560d532416788914b9f67399a (patch)
tree05a58c2098a027a663771fd9fcc23e4d8a63ef15 /common
parent895b751c92775f7610869a205d58a0a7c98632e0 (diff)
downloadtigervnc-213c12c4f12101b560d532416788914b9f67399a.tar.gz
tigervnc-213c12c4f12101b560d532416788914b9f67399a.zip
Change some assertions to exceptions
Diffstat (limited to 'common')
-rw-r--r--common/rdr/AESInStream.cxx4
-rw-r--r--common/rdr/AESOutStream.cxx6
-rw-r--r--common/rfb/CSecurityRSAAES.cxx4
-rw-r--r--common/rfb/SSecurityRSAAES.cxx4
4 files changed, 13 insertions, 5 deletions
diff --git a/common/rdr/AESInStream.cxx b/common/rdr/AESInStream.cxx
index a4890899..b10a214a 100644
--- a/common/rdr/AESInStream.cxx
+++ b/common/rdr/AESInStream.cxx
@@ -22,6 +22,8 @@
#include <assert.h>
+#include <stdexcept>
+
#include <rdr/AESInStream.h>
#ifdef HAVE_NETTLE
@@ -36,7 +38,7 @@ AESInStream::AESInStream(InStream* _in, const uint8_t* key,
else if (keySize == 256)
EAX_SET_KEY(&eaxCtx256, aes256_set_encrypt_key, aes256_encrypt, key);
else
- assert(!"incorrect key size");
+ throw std::out_of_range("Incorrect key size");
}
AESInStream::~AESInStream() {}
diff --git a/common/rdr/AESOutStream.cxx b/common/rdr/AESOutStream.cxx
index fcb3e37a..1ec38b56 100644
--- a/common/rdr/AESOutStream.cxx
+++ b/common/rdr/AESOutStream.cxx
@@ -21,7 +21,9 @@
#endif
#include <assert.h>
-#include <rdr/Exception.h>
+
+#include <stdexcept>
+
#include <rdr/AESOutStream.h>
#ifdef HAVE_NETTLE
@@ -39,7 +41,7 @@ AESOutStream::AESOutStream(OutStream* _out, const uint8_t* key,
else if (keySize == 256)
EAX_SET_KEY(&eaxCtx256, aes256_set_encrypt_key, aes256_encrypt, key);
else
- assert(!"incorrect key size");
+ throw std::out_of_range("Incorrect key size");
}
AESOutStream::~AESOutStream()
diff --git a/common/rfb/CSecurityRSAAES.cxx b/common/rfb/CSecurityRSAAES.cxx
index 416eaa2d..56e1d702 100644
--- a/common/rfb/CSecurityRSAAES.cxx
+++ b/common/rfb/CSecurityRSAAES.cxx
@@ -126,7 +126,9 @@ bool CSecurityRSAAES::processMsg()
writeCredentials();
return true;
}
- assert(!"unreachable");
+
+ throw std::logic_error("Invalid state");
+
return false;
}
diff --git a/common/rfb/SSecurityRSAAES.cxx b/common/rfb/SSecurityRSAAES.cxx
index 1e5f2384..46b66ca9 100644
--- a/common/rfb/SSecurityRSAAES.cxx
+++ b/common/rfb/SSecurityRSAAES.cxx
@@ -278,7 +278,9 @@ bool SSecurityRSAAES::processMsg()
verifyPass();
return true;
}
- assert(!"unreachable");
+
+ throw std::logic_error("Invalid state");
+
return false;
}