From b3a22f38ea7617e609a73938d0db11cf4f77f5dc Mon Sep 17 00:00:00 2001 From: Vincent Celier Date: Wed, 6 Jun 2007 12:21:22 +0200 Subject: a-tifiio.adb (Put, internal): For negative numbers... 2007-04-20 Vincent Celier * a-tifiio.adb (Put, internal): For negative numbers, check that there is room for at least one digit and the minus sign. (Put.Put_Character): Never put a character outside of the range of string To. From-SVN: r125382 --- gcc/ada/a-tifiio.adb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/a-tifiio.adb b/gcc/ada/a-tifiio.adb index fe06c2c..92c24ea 100644 --- a/gcc/ada/a-tifiio.adb +++ b/gcc/ada/a-tifiio.adb @@ -399,7 +399,7 @@ package body Ada.Text_IO.Fixed_IO is Last : Natural; begin - if Fore < 1 or else Fore > Field'Last then + if Fore - Boolean'Pos (Item < 0.0) < 1 or else Fore > Field'Last then raise Layout_Error; end if; @@ -462,7 +462,13 @@ package body Ada.Text_IO.Fixed_IO is procedure Put_Character (C : Character) is begin Last := Last + 1; - To (Last) := C; + + -- Never put a character outside of string To. Exception Layout_Error + -- will be raised later if Last is greater than To'Last. + + if Last <= To'Last then + To (Last) := C; + end if; end Put_Character; --------------- -- cgit v1.1