aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2018-07-31 09:56:53 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-07-31 09:56:53 +0000
commit1c0b35aac933587f8ed9886b2f8435016cb391ea (patch)
treeae1d0cf2e468f1f81fa14d79edece97a25b357ee
parentfa9f3f8c448e8e7d1b0d61742059218398f59b09 (diff)
downloadgcc-1c0b35aac933587f8ed9886b2f8435016cb391ea.zip
gcc-1c0b35aac933587f8ed9886b2f8435016cb391ea.tar.gz
gcc-1c0b35aac933587f8ed9886b2f8435016cb391ea.tar.bz2
[Ada] Fix potential Constraint_Error if Library_Version is too long
2018-07-31 Arnaud Charlet <charlet@adacore.com> gcc/ada/ * gnatlink.adb: Fix potential Constraint_Error if Library_Version is too long. From-SVN: r263107
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gnatlink.adb6
2 files changed, 9 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 92ec751..ba9599e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2018-07-31 Arnaud Charlet <charlet@adacore.com>
+ * gnatlink.adb: Fix potential Constraint_Error if
+ Library_Version is too long.
+
+2018-07-31 Arnaud Charlet <charlet@adacore.com>
+
* sem_elab.adb: Remove duplicate condition detected by CodePeer.
2018-07-31 Ed Schonberg <schonberg@adacore.com>
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb
index f712a7a..16981b8 100644
--- a/gcc/ada/gnatlink.adb
+++ b/gcc/ada/gnatlink.adb
@@ -1102,8 +1102,10 @@ procedure Gnatlink is
-- We will be looking for the static version of the library
-- as it is in the same directory as the shared version.
- if Next_Line (Nlast - Library_Version'Length + 1 .. Nlast) =
- Library_Version
+ if Nlast >= Library_Version'Length
+ and then Next_Line
+ (Nlast - Library_Version'Length + 1 .. Nlast)
+ = Library_Version
then
-- Set Last to point to last character before the
-- library version.