diff --git a/parser/bignum.h b/parser/bignum.h index 438294457..757da4964 100644 --- a/parser/bignum.h +++ b/parser/bignum.h @@ -59,11 +59,11 @@ public: size_t i; bool flag = true; for (i = 0; i < 16; i++) { - if ((val[i] & 0xF0) >> 4 != 0) + if (flag && (val[i] & 0xF0) >> 4 != 0) flag = false; if (!flag) data.push_back((val[i] & 0xF0) >> 4); - if ((val[i] & 0x0F) != 0) + if (flag && (val[i] & 0x0F) != 0) flag = false; if (!flag) data.push_back(val[i] & 0x0F); diff --git a/parser/parser_regex.c b/parser/parser_regex.c index 440a1525e..7d1847692 100644 --- a/parser/parser_regex.c +++ b/parser/parser_regex.c @@ -886,7 +886,10 @@ static std::string generate_regex_range(bignum start, bignum end) for (auto &i: regex_range) { bignum sstart = i.first; bignum send = i.second; - + if (sstart.base == 16) { + for (j = (size_t) sstart.size(); j < 32; j++) + result << '0'; + } for (j = sstart.size() - 1; j >= 0; j--) { result << std::nouppercase; if (sstart[j] == send[j]) {