public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1437] [Ada] Single character argument in call to Quote_Argument raises error
@ 2022-07-04  7:51 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-04  7:51 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1fde86bba55ea61b56f79798c6ac4cc6808e51a1

commit r13-1437-g1fde86bba55ea61b56f79798c6ac4cc6808e51a1
Author: Justin Squirek <squirek@adacore.com>
Date:   Thu May 26 15:15:46 2022 +0000

    [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.

Diff:
---
 gcc/ada/libgnat/s-os_lib.adb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/ada/libgnat/s-os_lib.adb b/gcc/ada/libgnat/s-os_lib.adb
index 5af65866b2b..53dfbf93f18 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-04  7:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04  7:51 [gcc r13-1437] [Ada] Single character argument in call to Quote_Argument raises error Pierre-Marie de Rodat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).