3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-08 02:15:20 +00:00

Merge pull request #1539 from YosysHQ/mwk/ilang-bounds-check

read_ilang: do bounds checking on bit indices
This commit is contained in:
Clifford Wolf 2019-12-01 16:30:48 -08:00 committed by GitHub
commit cacf870d85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
} |