diff options
author | Justin Squirek <squirek@adacore.com> | 2022-05-26 15:15:46 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-07-04 07:45:56 +0000 |
commit | 1fde86bba55ea61b56f79798c6ac4cc6808e51a1 (patch) | |
tree | 6439cf96a8e51ea69a2c5bc142e22501a3d9b7cf /gcc/ada | |
parent | 3319015b0a498ed1050d6910f75430a6fc401f50 (diff) | |
download | gcc-1fde86bba55ea61b56f79798c6ac4cc6808e51a1.zip gcc-1fde86bba55ea61b56f79798c6ac4cc6808e51a1.tar.gz gcc-1fde86bba55ea61b56f79798c6ac4cc6808e51a1.tar.bz2 |
[Ada] Single character argument in call to Quote_Argument raises error
This patch corrects an issue in the compiler whereby calling
Quote_Argument with an argument that is of size 1 may lead to a
CONSTRAINT_ERROR raised at runtime due to an undersized buffer.
gcc/ada/
* libgnat/s-os_lib.adb (Quote_Argument): Modify the result
buffer size calculation to handle the case where Arg'Length is
1.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/libgnat/s-os_lib.adb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/ada/libgnat/s-os_lib.adb b/gcc/ada/libgnat/s-os_lib.adb index 5af6586..53dfbf9 100644 --- a/gcc/ada/libgnat/s-os_lib.adb +++ b/gcc/ada/libgnat/s-os_lib.adb @@ -1940,7 +1940,7 @@ package body System.OS_Lib is procedure Quote_Argument (Arg : in out String_Access) is J : Positive := 1; Quote_Needed : Boolean := False; - Res : String (1 .. Arg'Length * 2); + Res : String (1 .. Arg'Length * 2 + 2); begin if Arg (Arg'First) /= '"' or else Arg (Arg'Last) /= '"' then |