aboutsummaryrefslogtreecommitdiffstats
path: root/frontends
diff options
context:
space:
mode:
authorMarcin Koƛcielnicki <koriakin@0x04.net>2019-11-27 22:24:39 +0100
committerMarcin Koƛcielnicki <koriakin@0x04.net>2019-11-27 22:24:39 +0100
commit0ce22cea465939ed0b2c48cb21ff07340aefbc49 (patch)
treee5212271eed0c15ed8b0b8975689d32cd83aa8b1 /frontends
parent6464dc35ec0c57b55aa19345b17eb34f47c15986 (diff)
downloadyosys-0ce22cea465939ed0b2c48cb21ff07340aefbc49.tar.gz
yosys-0ce22cea465939ed0b2c48cb21ff07340aefbc49.tar.bz2
yosys-0ce22cea465939ed0b2c48cb21ff07340aefbc49.zip
read_ilang: do bounds checking on bit indices
Diffstat (limited to 'frontends')
-rw-r--r--frontends/ilang/ilang_parser.y4
1 files changed, 4 insertions, 0 deletions
diff --git a/frontends/ilang/ilang_parser.y b/frontends/ilang/ilang_parser.y
index b4b9693da..4e0b62edd 100644
--- a/frontends/ilang/ilang_parser.y
+++ b/frontends/ilang/ilang_parser.y
@@ -430,10 +430,14 @@ sigspec:
free($1);
} |
sigspec '[' TOK_INT ']' {
+ if ($3 >= $1->size() || $3 < 0)
+ rtlil_frontend_ilang_yyerror("bit index out of range");
$$ = new RTLIL::SigSpec($1->extract($3));
delete $1;
} |
sigspec '[' TOK_INT ':' TOK_INT ']' {
+ if ($3 >= $1->size() || $3 < 0 || $3 < $5)
+ rtlil_frontend_ilang_yyerror("invalid slice");
$$ = new RTLIL::SigSpec($1->extract($5, $3 - $5 + 1));
delete $1;
} |