aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-strsea.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-07-07 15:17:29 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-07-07 15:17:29 +0200
commit85686ad98b329307ecdcdef3e75babbb8eed799d (patch)
tree1e562c0445072b89dd2bfe94a28901abce44a340 /gcc/ada/a-strsea.adb
parent54ecb428e7c408f1d8e018be6bb35147756ae0a4 (diff)
downloadgcc-85686ad98b329307ecdcdef3e75babbb8eed799d.zip
gcc-85686ad98b329307ecdcdef3e75babbb8eed799d.tar.gz
gcc-85686ad98b329307ecdcdef3e75babbb8eed799d.tar.bz2
[multiple changes]
2009-07-07 Robert Dewar <dewar@adacore.com> * prj-nmsc.adb: Minor reformatting 2009-07-07 Pascal Obry <obry@adacore.com> * a-stwise.adb, a-stzsea.adb, a-strsea.adb (Index): properly handle cases where Pattern is longer than Source. 2009-07-07 Pascal Obry <obry@adacore.com> * s-osprim-mingw.adb (Get_Base_Time): Avoid infinite loop. From-SVN: r149326
Diffstat (limited to 'gcc/ada/a-strsea.adb')
-rw-r--r--gcc/ada/a-strsea.adb12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ada/a-strsea.adb b/gcc/ada/a-strsea.adb
index a9093ed..dbeb0e4 100644
--- a/gcc/ada/a-strsea.adb
+++ b/gcc/ada/a-strsea.adb
@@ -246,6 +246,12 @@ package body Ada.Strings.Search is
raise Pattern_Error;
end if;
+ -- If Pattern longer than Source it can't be found
+
+ if Pattern'Length > Source'Length then
+ return 0;
+ end if;
+
-- Forwards case
if Going = Forward then
@@ -348,6 +354,12 @@ package body Ada.Strings.Search is
raise Constraint_Error;
end if;
+ -- If Pattern longer than Source it can't be found
+
+ if Pattern'Length > Source'Length then
+ return 0;
+ end if;
+
-- Forwards case
if Going = Forward then