2018-06-11 Nicolas Roche <roche@adacore.com>
gcc/ada/
* libgnat/s-valuti.adb (Bad_Value): Ensure that we do not generate a
stack overflow while raising a constraint error.
From-SVN: r261396
+2018-06-11 Nicolas Roche <roche@adacore.com>
+
+ * libgnat/s-valuti.adb (Bad_Value): Ensure that we do not generate a
+ stack overflow while raising a constraint error.
+
2018-06-11 Eric Botcazou <ebotcazou@adacore.com>
* repinfo.ads (Rep_Value): Use a single line.
procedure Bad_Value (S : String) is
begin
- raise Constraint_Error with "bad input for 'Value: """ & S & '"';
+ -- Bad_Value might be called with very long strings allocated on the
+ -- heap. Limit the size of the message so that we avoid creating a
+ -- Storage_Error during error handling.
+ if S'Length > 127 then
+ raise Constraint_Error with "bad input for 'Value: """
+ & S (S'First .. S'First + 127) & "...""";
+ else
+ raise Constraint_Error with "bad input for 'Value: """ & S & '"';
+ end if;
end Bad_Value;
----------------------