s-regpat.adb (Parse_Character_Class): Fix handling of empty character classes ("...
authorEmmanuel Briot <briot@adacore.com>
Mon, 10 Sep 2007 12:47:36 +0000 (14:47 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 10 Sep 2007 12:47:36 +0000 (14:47 +0200)
2007-09-10  Emmanuel Briot  <briot@adacore.com>

* s-regpat.adb (Parse_Character_Class): Fix handling of empty character
classes ("[]").

From-SVN: r128333

gcc/ada/s-regpat.adb

index c1e924797ebc826656512df961a8f9f3548bc427..2441271f0e5accc404dca135e3c7c1f8b53aa2d3 100755 (executable)
@@ -1457,6 +1457,10 @@ package body System.Regpat is
             elsif not In_Range then
                Last_Value := Value;
 
+               if Parse_Pos > Expression'Last then
+                  Fail ("Empty character class []");
+               end if;
+
                if Expression (Parse_Pos) = '-'
                  and then Parse_Pos < Parse_End
                  and then Expression (Parse_Pos + 1) /= ']'