[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

out of memory crash when accessing broken .la files

From: Dirk Mueller
Subject: out of memory crash when accessing broken .la files
Date: Tue, 14 Aug 2007 13:17:34 +0200
User-agent: KMail/1.9.7


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))
@@ -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))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]