diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-03 14:21:01 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-04 00:31:22 +0200 |
commit | 62bf296a9c0f5be492f0677ed111b3fa217f4c11 (patch) | |
tree | f49564b3d70a12ee4e16e84c4e4e33a2adce1133 /libqpdf/QPDF_encryption.cc | |
parent | 92b692466f7a4dbf4e51e6a77713c029a3e18ab1 (diff) | |
download | qpdf-62bf296a9c0f5be492f0677ed111b3fa217f4c11.tar.zst |
Make assert handling less error-prone
Prevent my future self or other contributors from using assert in
tests and then having that assert not do anything because of the
NDEBUG macro.
Diffstat (limited to 'libqpdf/QPDF_encryption.cc')
-rw-r--r-- | libqpdf/QPDF_encryption.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc index 14b22d88..6a9ad871 100644 --- a/libqpdf/QPDF_encryption.cc +++ b/libqpdf/QPDF_encryption.cc @@ -1,6 +1,8 @@ // This file implements methods from the QPDF class that involve // encryption. +#include <qpdf/assert_debug.h> + #include <qpdf/QPDF.hh> #include <qpdf/QPDFExc.hh> @@ -15,7 +17,6 @@ #include <qpdf/RC4.hh> #include <algorithm> -#include <cassert> #include <string.h> static unsigned char const padding_string[] = { @@ -288,7 +289,7 @@ hash_V5( ++round_number; std::string K1 = password + K + udata; - assert(K.length() >= 32); + qpdf_assert_debug(K.length() >= 32); std::string E = process_with_aes( K.substr(0, 16), true, |