diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-01-20 07:58:27 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-01-20 14:25:54 +0100 |
commit | 2c1fcdea4def5a009aa031dfb37326a9db3b22dd (patch) | |
tree | 4872ceea1a476153c6dc44aba4a43be8d4c9105a /src/ortho/mcode | |
parent | 6df8dc1d3d5f23295c01ea8f565e4a048a279460 (diff) | |
download | ghdl-2c1fcdea4def5a009aa031dfb37326a9db3b22dd.tar.gz ghdl-2c1fcdea4def5a009aa031dfb37326a9db3b22dd.tar.bz2 ghdl-2c1fcdea4def5a009aa031dfb37326a9db3b22dd.zip |
mcode: assert identifiers don't have embedded NULL.
Diffstat (limited to 'src/ortho/mcode')
-rw-r--r-- | src/ortho/mcode/ortho_ident.adb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ortho/mcode/ortho_ident.adb b/src/ortho/mcode/ortho_ident.adb index 9b5a36ed0..c3990320d 100644 --- a/src/ortho/mcode/ortho_ident.adb +++ b/src/ortho/mcode/ortho_ident.adb @@ -37,9 +37,12 @@ package body Ortho_Ident is begin Start := Strs.Allocate (Str'Length + 1); for I in Str'Range loop + -- Identifiers are NULL terminated, so they cannot have any + -- embedded NULL. + pragma Assert (Str (I) /= ASCII.NUL); Strs.Table (Start + I - Str'First) := Str (I); end loop; - Strs.Table (Start + Str'Length) := ASCII.Nul; + Strs.Table (Start + Str'Length) := ASCII.NUL; Ids.Append (Start); return Ids.Last; end Get_Identifier; |