diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-06 10:21:22 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-06-06 10:21:22 +0000 |
commit | 41224134e586f5b77805185c141cf7c0b67135b6 (patch) | |
tree | fe058ca7174400369c44887a7119615a5f57cd46 /gcc/ada | |
parent | ad075b4ddabc6a7c1496a9f41e46f90f2b8f9226 (diff) | |
download | gcc-41224134e586f5b77805185c141cf7c0b67135b6.tar.gz |
2007-04-20 Vincent Celier <celier@adacore.com>
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125382 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/a-tifiio.adb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/ada/a-tifiio.adb b/gcc/ada/a-tifiio.adb index fe06c2c99e7..92c24ea55c5 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; --------------- |