api: Add missing bit-width 0 check to mkBVFromStrHelper. (#7727)
authorMathias Preiner <mathias.preiner@gmail.com>
Wed, 1 Dec 2021 22:28:37 +0000 (14:28 -0800)
committerGitHub <noreply@github.com>
Wed, 1 Dec 2021 22:28:37 +0000 (22:28 +0000)
src/api/cpp/cvc5.cpp

index 3edff5ec335a9ae6971eb576ffabe3d36328dd6a..6129ff89130ca7e9f6656164a297a3abef18428e 100644 (file)
@@ -5081,6 +5081,7 @@ Term Solver::mkBVFromStrHelper(uint32_t size,
                                const std::string& s,
                                uint32_t base) const
 {
+  CVC5_API_ARG_CHECK_EXPECTED(size > 0, size) << "a bit-width > 0";
   CVC5_API_ARG_CHECK_EXPECTED(!s.empty(), s) << "a non-empty string";
   CVC5_API_ARG_CHECK_EXPECTED(base == 2 || base == 10 || base == 16, base)
       << "base 2, 10, or 16";
@@ -5090,7 +5091,7 @@ Term Solver::mkBVFromStrHelper(uint32_t size,
 
   if (val.strictlyNegative())
   {
-    CVC5_API_CHECK(val >= -Integer("2", 10).pow(size - 1))
+    CVC5_API_CHECK(val >= -Integer(2).pow(size - 1))
         << "Overflow in bitvector construction (specified bitvector size "
         << size << " too small to hold value " << s << ")";
   }