-
Notifications
You must be signed in to change notification settings - Fork 478
Fix SIGSEGV when v1model version is negative or invalid #5436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Jiri Havranek <jiri.havranek@altera.com>
|
Also tried with value from the issue: |
frontends/p4/getV1ModelVersion.h
Outdated
| bool preorder(const IR::Declaration_Constant *dc) override { | ||
| if (dc->name == "__v1model_version") { | ||
| const auto *val = dc->initializer->to<IR::Constant>(); | ||
| if (!val) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be if (!val || val->value < 0). The only reason this seems to work without it is because -6419018 is initially IR::Neg on an IR::Constant, and if constant-folding runs it will be simplified.
Might also want to limit it to just known valid versions of V1MODEL_VERSION
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChrisDodd, is there any list of valid versions of V1MODEL_VERSION somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grepped this list of versions from testdata/
20160101
20180000
20180101
20200000
20200408
Signed-off-by: Jiri Havranek <jiri.havranek@altera.com>
Signed-off-by: Jiri Havranek <jiri.havranek@altera.com>
Signed-off-by: Kyle Cripps <kyle@pensando.io>
Signed-off-by: Kyle Cripps <kyle@pensando.io>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: Michal Kekely <michal.kekely@altera.com>
Signed-off-by: Michal Kekely <michal.kekely@altera.com>
Signed-off-by: Mouse <mouse@mojatatu.com> Signed-off-by: Victor Nogueira <victor@mojatatu.com> Co-authored-by: Mouse <mouse@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Signed-off-by: Bryan Richter <b@chreekat.net>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: fruffy <fruffy@nyu.edu>
…n the `ErrorCatalog` (p4lang#5360) Signed-off-by: kfcripps <kyle@pensando.io>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Vineet1101 <Vineetgoel692@gmail.com>
Signed-off-by: KunJeong <kunjeong99@naver.com>
…5366) Signed-off-by: djparker21 <drparker@amd.com>
Signed-off-by: Bryan Richter <b@chreekat.net>
Signed-off-by: fruffy <fruffy@nyu.edu>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
…ng#5393) Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: Bryan Richter <b@chreekat.net>
Signed-off-by: Kyle Cripps <kyle@pensando.io>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: Bryan Richter <b@chreekat.net>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com> Co-authored-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com> Co-authored-by: Jamal Hadi Salim <jhs@mojatatu.com> Co-authored-by: Pedro Tammela <pctammela@mojatatu.com>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Co-authored-by: rst0git <9142901+rst0git@users.noreply.github.com>
Signed-off-by: fruffy <fruffy@nyu.edu>
…king again (p4lang#5424) Signed-off-by: Andy Fingerhut <andy_fingerhut@alum.wustl.edu> Signed-off-by: fruffy <fruffy@nyu.edu> Co-authored-by: fruffy <fruffy@nyu.edu>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
…actually valid (p4lang#5417) Signed-off-by: fruffy <fruffy@nyu.edu>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: Victor Nogueira <victor@mojatatu.com> Co-authored-by: Jamal Hadi Salim <jhs@mojatatu.com> Co-authored-by: Pedro Tammela <pctammela@mojatatu.com>
Co-authored-by: rst0git <9142901+rst0git@users.noreply.github.com>
Signed-off-by: Vladimir Still <dev.p4@vstill.eu> Signed-off-by: Denis Matousek <denis.matousek@altera.com> Co-authored-by: Denis Matousek <denis.matousek@altera.com>
Signed-off-by: Vladimír Štill <vladimir.still@altera.com> Signed-off-by: Denis Matousek <denis.matousek@altera.com> Co-authored-by: Denis Matousek <denis.matousek@altera.com>
…4lang#5432) Signed-off-by: djparker21 <drparker@amd.com>
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Signed-off-by: Vladimír Štill <vladimir.still@altera.com> Signed-off-by: Denis Matousek <denis.matousek@altera.com> Co-authored-by: Vladimír Štill <vladimir.still@altera.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Jiri Havranek <jiri.havranek@altera.com>
Signed-off-by: Jiri Havranek <jiri.havranek@altera.com>
Adds missing validation for v1model value constant. Fixes #5296