Add assert to RemainingLength member function

pull/853/head
Jeffrey Walton 2019-06-04 09:29:01 -04:00
parent 238578a808
commit 198b081df5
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
1 changed files with 9 additions and 2 deletions

11
asn.h
View File

@ -285,11 +285,18 @@ public:
/// \brief Determine length encoding
/// \returns true if the ASN.1 object is definite length encoded, false otherwise
bool IsDefiniteLength() const {return m_definiteLength;}
bool IsDefiniteLength() const {
return m_definiteLength;
}
/// \brief Determine remaining length
/// \returns number of octets that remain to be consumed
lword RemainingLength() const {return m_length;}
/// \details RemainingLength() is only valid if IsDefiniteLength()
/// returns true.
lword RemainingLength() const {
CRYPTOPP_ASSERT(m_definiteLength);
return IsDefiniteLength() ? m_length : 0;
}
/// \brief Determine end of stream
/// \returns true if all octets have been consumed, false otherwise