Fix infinite loop in is_linked_with_cygwin_dll
authorTom Tromey <tromey@adacore.com>
Thu, 23 Apr 2020 18:15:28 +0000 (12:15 -0600)
committerTom Tromey <tromey@adacore.com>
Thu, 23 Apr 2020 18:53:15 +0000 (12:53 -0600)
There were some Windows timeouts after the last merge.  Debugging
showed that these were caused by an infinite loop in
is_linked_with_cygwin_dll when reading C:\Windows\SysWOW64\win32u.dll.

This patch fixes the problem by ensuring that the loop always makes
progress.

gdb/ChangeLog
2020-04-23  Tom Tromey  <tromey@adacore.com>

* windows-tdep.c (is_linked_with_cygwin_dll): Always update "iter"
in loop.

gdb/ChangeLog
gdb/windows-tdep.c

index 145328dda1c553e4b36ef2f244b5599876910e57..85fa7cf5f76fa0eabcaf49c81668d1f93f06f002 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-23  Tom Tromey  <tromey@adacore.com>
+
+       * windows-tdep.c (is_linked_with_cygwin_dll): Always update "iter"
+       in loop.
+
 2020-04-23  Luis Machado  <luis.machado@linaro.org>
 
        * dwarf2/frame-tailcall.c (dwarf2_tailcall_sniffer_first): Use
index e2b7960829f71b0882e057cecd5dd1dabcda2727..153ad132b965acedd0410bf2c3afc96622023c5f 100644 (file)
@@ -1071,18 +1071,19 @@ range [0x%" BFD_VMA_FMT "x, 0x%" BFD_VMA_FMT "x[."),
 
       const gdb_byte *name = &idata_contents[name_va - idata_section_va];
 
-      /* Make sure we don't overshoot the end of the section with the streq.  */
-      if (name + sizeof (CYGWIN_DLL_NAME) > end)
-       continue;
-
-      /* Finally, check if this is the dll name we are looking for.  */
-      if (streq ((const char *) name, CYGWIN_DLL_NAME))
-       return true;
+      /* Make sure we don't overshoot the end of the section with the
+        streq.  */
+      if (name + sizeof (CYGWIN_DLL_NAME) <= end)
+       {
+         /* Finally, check if this is the dll name we are looking for.  */
+         if (streq ((const char *) name, CYGWIN_DLL_NAME))
+           return true;
+       }
 
       iter += sizeof (pe_import_directory_entry);
     }
 
-    return false;
+  return false;
 }
 
 void _initialize_windows_tdep ();
This page took 0.03562 seconds and 4 git commands to generate.