mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Fix misc bad-syntax crashes, bug1530.
This commit is contained in:
+8
-1
@@ -31,6 +31,7 @@
|
||||
#include <iomanip>
|
||||
|
||||
#define MAX_SPRINTF_DOUBLE_SIZE 100 // Maximum characters with a sprintf %e/%f/%g (probably < 30)
|
||||
#define MAX_WIDTH 5*1024 // Maximum width before error
|
||||
|
||||
// Number operations build output in-place so can't call e.g. foo.opX(foo)
|
||||
#define NUM_ASSERT_OP_ARGS1(arg1) \
|
||||
@@ -106,7 +107,13 @@ void V3Number::V3NumberCreate(AstNode* nodep, const char* sourcep, FileLine* fl)
|
||||
value_startp = cp;
|
||||
|
||||
if (atoi(widthn)) {
|
||||
width(atoi(widthn), true);
|
||||
if (atoi(widthn) < 0 || atoi(widthn) > MAX_WIDTH) {
|
||||
// atoi might convert large number to negative, so can't tell which
|
||||
v3error("Unsupported: Width of number exceeds implementation limit: "<<sourcep);
|
||||
width(MAX_WIDTH, true);
|
||||
} else {
|
||||
width(atoi(widthn), true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unbased = true;
|
||||
|
||||
Reference in New Issue
Block a user