This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] PR24827, Linker loops forever if unterminated multi-line comment in script
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 20 Jul 2019 01:25:36 -0000
- Subject: [binutils-gdb] PR24827, Linker loops forever if unterminated multi-line comment in script
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9ab3a74416dac187d56fcf292b39b681d1362dae
commit 9ab3a74416dac187d56fcf292b39b681d1362dae
Author: Alan Modra <amodra@gmail.com>
Date: Sat Jul 20 10:47:20 2019 +0930
PR24827, Linker loops forever if unterminated multi-line comment in script
YY_INPUT returns 0 on end of input, not EOF.
PR 24827
* ldlex.l (comment): Check for 0 return from input(), not EOF.
Diff:
---
ld/ChangeLog | 5 +++++
ld/ldlex.l | 4 ++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 9fcc55c..4145096 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,8 @@
+2019-07-20 Alan Modra <amodra@gmail.com>
+
+ PR 24827
+ * ldlex.l (comment): Check for 0 return from YY_INPUT, not EOF.
+
2019-07-19 Alan Modra <amodra@gmail.com>
* testsuite/ld-powerpc/tlsgd.d,
diff --git a/ld/ldlex.l b/ld/ldlex.l
index c2abc59..a5c3ba5 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -675,7 +675,7 @@ comment (void)
while (1)
{
c = input();
- while (c != '*' && c != EOF)
+ while (c != '*' && c != 0)
{
if (c == '\n')
lineno++;
@@ -694,7 +694,7 @@ comment (void)
if (c == '\n')
lineno++;
- if (c == EOF)
+ if (c == 0)
{
einfo (_("%F%P: EOF in comment\n"));
break;