# HG changeset patch # User Alexander Krotov # Date 1497363564 -10800 # Tue Jun 13 17:19:24 2017 +0300 # Node ID 71bc6d01b92a6692bd51d4ab3a54dfec5fa0ff5a # Parent f572343f7d36efe20cda1eea5b74c65dba4b11ac lte: Assert that integer is within range in Asn1Header::SerializeInteger diff -r f572343f7d36 -r 71bc6d01b92a src/lte/model/lte-asn1-header.cc --- a/src/lte/model/lte-asn1-header.cc Tue Jun 13 16:51:57 2017 +0300 +++ b/src/lte/model/lte-asn1-header.cc Tue Jun 13 17:19:24 2017 +0300 @@ -321,13 +321,8 @@ void Asn1Header::SerializeInteger (int n, int nmin, int nmax) const { - // Misusage check: Ensure nmax>nmin ... - if (nmin > nmax) - { - int aux = nmin; - nmin = nmax; - nmax = aux; - } + NS_ASSERT_MSG (nmin <= n && n <= nmax, + "Integer " << n << " is outside range [" << nmin << ", " << nmax << "]"); // Clause 11.5.3 ITU-T X.691 int range = nmax - nmin + 1;