This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] binutils/resrc.c



Hello,

I bumped into a bug in "windres" while trying to cross-build 
GTK+ on x86 Linux targeting i386-mingw32msvc.

In binutils/resrc.c: close_input_stream(), pclose() is 
called twice on the same stream, which calls free() on
the same pointer underneath.  This corrupts the glibc
malloc internal stuff, which later leads to a segfault
inside glibc's malloc.c.   Maybe this doesn't happen
on native Win32, thus no one noticed before.

I've included a small patch, and the .rc file which 
triggered the bug when invoked as follows,

$ i386-mingw32msvc-windres glib-win32res.rc glib-win32res.o

although I suppose just about any file would have triggered it.

Cheers,
-Jamie

-- 
================================================================
Jamie Guinan                         Blue Button Solutions, Inc.
guinan@bluebutton.com                  http://www.bluebutton.com
================================================================
#include <winver.h>



VS_VERSION_INFO VERSIONINFO

  FILEVERSION 1,3,1,0

  PRODUCTVERSION 1,3,1,0

  FILEFLAGSMASK 0

  FILEFLAGS 0

  FILEOS VOS__WINDOWS32

  FILETYPE VFT_DLL

  FILESUBTYPE VFT2_UNKNOWN

  BEGIN

    BLOCK "StringFileInfo"

    BEGIN

      BLOCK "040904B0"

      BEGIN

	VALUE "CompanyName", "The GLib developer community"

	VALUE "FileDescription", "GLib"

	VALUE "FileVersion", "1.3.1.0"

	VALUE "InternalName", "glib-1.3"

	VALUE "LegalCopyright", "Copyright © 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald. Modified by the GLib Team and others 1997-2000."

	VALUE "OriginalFilename", "glib-1.3.dll"

	VALUE "ProductName", "GLib"

	VALUE "ProductVersion", "1.3.1"

      END

    END

    BLOCK "VarFileInfo"

    BEGIN

      VALUE "Translation", 0x409, 1200

    END

  END

*** /usr/local/source/binutils-2.10/binutils/resrc.c	Fri Feb 18 22:59:10 2000
--- resrc.c	Tue Aug 29 18:45:51 2000
***************
*** 498,506 ****
  static void
  close_input_stream ()
  {
-   if (cpp_pipe != NULL)
-     pclose (cpp_pipe);
-   
    if (istream_type == ISTREAM_FILE)
      {
        if (cpp_pipe != NULL)
--- 498,503 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]