Hi, 

when libtool .la files contain NUL bytes due to a corruption, there is a very 
ugly memory eating loop triggered in libltdl. the problem is that it believes 
the buffer was too small, and keeps resizing it until the machine dies (or 
ulimits kill the process). 

the patch below should avoid this issue: 

--- a/libtool-1.5.24/libltdl/ltdl.c
+++ b/libtool-1.5.24/libltdl/ltdl.c
@@ -3249,6 +3249,7 @@ try_dlopen (phandle, filename)
       /* read the .la file */
       while (!feof (file))
        {
+          line[line_len-2] = '\0';
          if (!fgets (line, (int) line_len, file))
            {
              break;
@@ -3256,7 +3257,7 @@ try_dlopen (phandle, filename)

          /* Handle the case where we occasionally need to read a line
             that is longer than the initial buffer size.  */
-         while ((line[LT_STRLEN(line) -1] != '\n') && (!feof (file)))
+         while (line[line_len-2] && (!feof (file)))
            {
              line = LT_DLREALLOC (char, line, line_len *2);
              if (!fgets (&line[line_len -1], (int) line_len +1, file))

Thanks,
Dirk


_______________________________________________
Bug-libtool mailing list
Bug-libtool@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-libtool

Reply via email to