aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2023-01-11 07:00:08 +0100
committerTristan Gingold <tgingold@free.fr>2023-01-11 07:00:08 +0100
commit467acc26b864bd0d4e531b1095cef067ba83cf3b (patch)
treeceefcf42c55f241033cb166dfd5a235c8cf5ec84
parent57ae0c0644abeab372644b7d274a9fee3cea3499 (diff)
downloadghdl-467acc26b864bd0d4e531b1095cef067ba83cf3b.tar.gz
ghdl-467acc26b864bd0d4e531b1095cef067ba83cf3b.tar.bz2
ghdl-467acc26b864bd0d4e531b1095cef067ba83cf3b.zip
synth: avoid a crash on very large object types
-rw-r--r--src/synth/elab-vhdl_objtypes.adb3
1 files changed, 3 insertions, 0 deletions
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;