Fixed segfault on invalid verilog constant 1'b_
authorClifford Wolf <clifford@clifford.at>
Tue, 22 Sep 2015 06:13:09 +0000 (08:13 +0200)
committerClifford Wolf <clifford@clifford.at>
Tue, 22 Sep 2015 06:13:09 +0000 (08:13 +0200)
frontends/verilog/const2ast.cc

index 9cc99750f4e1678d7b4f2b956c0111998f28f7a9..4a58357bf8157530923cfa2169603cc1a78010c4 100644 (file)
@@ -122,7 +122,7 @@ static void my_strtobin(std::vector<RTLIL::State> &data, const char *str, int le
        }
 
        int len = GetSize(data);
-       RTLIL::State msb = data.back();
+       RTLIL::State msb = data.empty() ? RTLIL::S0 : data.back();
 
        if (len_in_bits < 0) {
                if (len < 32)