]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - binutils/mclex.c
Fix a potential infinite loop in the Windows resource parser.
[thirdparty/binutils-gdb.git] / binutils / mclex.c
index 7e0688b07bfe02afa5ef174c234f32a10ca139de..1b5d5c374f34251f76c99aae5b2365924e715958 100644 (file)
@@ -337,17 +337,19 @@ yylex (void)
   if (mclex_want_line)
     {
       start_token = input_stream_pos;
+      if (input_stream_pos[0] == 0)
+       return -1;
       if (input_stream_pos[0] == '.'
          && (input_stream_pos[1] == '\n'
              || (input_stream_pos[1] == '\r' && input_stream_pos[2] == '\n')))
-      {
-       mclex_want_line = FALSE;
-       while (input_stream_pos[0] != 0 && input_stream_pos[0] != '\n')
-         ++input_stream_pos;
-       if (input_stream_pos[0] == '\n')
-         ++input_stream_pos;
-       return MCENDLINE;
-      }
+       {
+         mclex_want_line = FALSE;
+         while (input_stream_pos[0] != 0 && input_stream_pos[0] != '\n')
+           ++input_stream_pos;
+         if (input_stream_pos[0] == '\n')
+           ++input_stream_pos;
+         return MCENDLINE;
+       }
       while (input_stream_pos[0] != 0 && input_stream_pos[0] != '\n')
        ++input_stream_pos;
       if (input_stream_pos[0] == '\n')