OSDN Git Service

2007-09-10 Emmanuel Briot <briot@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Sep 2007 12:47:36 +0000 (12:47 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 10 Sep 2007 12:47:36 +0000 (12:47 +0000)
* s-regpat.adb (Parse_Character_Class): Fix handling of empty character
classes ("[]").

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128333 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/s-regpat.adb

index c1e9247..2441271 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) /= ']'