From 467acc26b864bd0d4e531b1095cef067ba83cf3b Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 11 Jan 2023 07:00:08 +0100 Subject: synth: avoid a crash on very large object types --- src/synth/elab-vhdl_objtypes.adb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/synth/elab-vhdl_objtypes.adb b/src/synth/elab-vhdl_objtypes.adb index ebde9f28b..37c53c7f5 100644 --- a/src/synth/elab-vhdl_objtypes.adb +++ b/src/synth/elab-vhdl_objtypes.adb @@ -569,6 +569,9 @@ package body Elab.Vhdl_Objtypes is end case; if Len < 0 then return 0; + elsif Len > Int64 (Uns32'Last) then + -- Truncate very large lengths, such objects should not exist. + return Uns32'Last; else return Uns32 (Len); end if; -- cgit v1.2.3