public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2077] [Ada] Handle malformed command line on Win32
@ 2021-07-06 14:50 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-06 14:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:d8870b1f64ae927e9469082490760b760ef5616f

commit r12-2077-gd8870b1f64ae927e9469082490760b760ef5616f
Author: Nicolas Roche <roche@adacore.com>
Date:   Tue May 11 07:58:42 2021 +0200

    [Ada] Handle malformed command line on Win32
    
    gcc/ada/
    
            * rtinit.c (skip_quoted_string): Handle malformed command line
            with no closing double quote.
            (skip_argument): Handle case in which a null character is
            encountered by skip_quote_string.

Diff:
---
 gcc/ada/rtinit.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/rtinit.c b/gcc/ada/rtinit.c
index 391c7e9406f..83a63c8eb45 100644
--- a/gcc/ada/rtinit.c
+++ b/gcc/ada/rtinit.c
@@ -147,6 +147,19 @@ static void skip_quoted_string (const WCHAR **current_in,
 	}
       ci++;
     }
+
+  /* Handle the case in which a nul character was found instead of a closing
+     double quote. In that case consider all the backslashes as literal
+     characters. */
+  if (*ci == '\0')
+    {
+      for (int i=0; i<qbs_count; i++)
+        {
+          *co='\\';
+          co++;
+        }
+    }
+
   *current_in = ci;
   *current_out = co;
 }
@@ -205,7 +218,10 @@ static void skip_argument (const WCHAR **current_in,
 	  bs_count = 0;
 	  *co = *ci; co++;
 	}
-      ci++;
+      if (*ci != '\0')
+        {
+          ci++;
+        }
     }
 
   for (int i=0; i<bs_count; i++)


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

only message in thread, other threads:[~2021-07-06 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 14:50 [gcc r12-2077] [Ada] Handle malformed command line on Win32 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).