summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Zeitz <florob@babelmonkeys.de>2015-08-17 15:37:33 +0200
committerFlorian Zeitz <florob@babelmonkeys.de>2015-08-17 15:37:33 +0200
commit04910428491f249b79f7974f118b8e01579b2a51 (patch)
treec291007c4e8e3fec8f7713c6d550a8cd429bb3ab
parent64ccbf8510d33f08af7743974d061db166da1832 (diff)
Check base-n literals only contain valid digits
-rw-r--r--frontends/verilog/const2ast.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/frontends/verilog/const2ast.cc b/frontends/verilog/const2ast.cc
index 6a932689..5bc8c700 100644
--- a/frontends/verilog/const2ast.cc
+++ b/frontends/verilog/const2ast.cc
@@ -104,6 +104,9 @@ static void my_strtobin(std::vector<RTLIL::State> &data, const char *str, int le
} else {
int bits_per_digit = my_ilog2(base-1);
for (auto it = digits.rbegin(), e = digits.rend(); it != e; it++) {
+ if (*it > (base-1) && *it < 0xf0)
+ log_error("Digit larger than %d used in in base-%d constant at %s:%d.\n",
+ base-1, base, current_filename.c_str(), get_line_num());
for (int i = 0; i < bits_per_digit; i++) {
int bitmask = 1 << i;
if (*it == 0xf0)