BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions

From: benny(at)hegne(dot)de
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8461: PostgreSQL 9.3 pg_dump heap corruptions
Date: 2013-09-18 10:05:44
Message-ID: E1VMEdk-00031c-R3@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 8461
Logged by: Benjamin Wassermann
Email address: benny(at)hegne(dot)de
PostgreSQL version: 9.3.0
Operating system: Windows
Description:

Hi!

We are trying to build our own PostgreSQL 9.3 using Visual Studio 2005 on
Windows XP.

If we use the created pg_dump we get some “Heap Corruptions” and no database
dump will be created.
When we use the precomiled binaries from PostgreSQL 9.3 and use this pg_dump
we do NOT get any heap corruption and it works as expected.

To reproduce the bug you need a Microsoft Visual Studio 2005 with Version
8.0.50727.42.

Buildsteps:
1. Download the postgresql sources 9.3
2. Open a visual studio commandline and change to folder
"postgresql-9.2.3\src\tools\msvc". Execute the command "perl mkvcbuild.pl"
(make sure "ActivePerl" is installed, where using version "5.12.2 Build
1202").
3. In the root folder is now a pgpsql.sln, which u can open in visual
studio
4. Now change the "Build-Target" to Release
5. Now build the Projects in following steps and configuartions
libpgport:
General > Use of MFC: "Use MFC in a Static Libary"
Libarian: Ingore Specific Libary "Nafxcwd.lib" and "Libcmtd.lib"
-> Build
libpqtypes:
General > Use of MFC: "Use MFC in a Static Libary"
-> Build
libpq:
General > Use of MFC: "Use MFC in a Static Libary"
Linker > Additional Dependencies: "ShFolder.lib" and "Advapi32.lib"
-> Build
libecpg:
General > Use of MFC: "Use MFC in a Static Libary"
-> Build
libpgcommon:
General > Use of MFC: "Use MFC in a Static Libary"
-> Build
psql:
General > Use of MFC: "Use MFC in a Static Libary"
Linker > Additional Dependencies: "Advapi32.lib"
Rename the Function _dosmaperr to _test_dosmaperr
-> Build
If there is a error like: "ERROR: psqlscan.c could not be found" just do
the following:
Open a commandline and call "flex.exe "<Path to
sources>\postgresql-9.2.3\src\bin\psql\psqlscan.l"
(http://gnuwin32.sourceforge.net/install.html). Now copy the created file to
"\postgresql-9.2.3\src\bin\psql\psqlscan.c".
-> Build
pg_dump:
General > Use of MFC: "Use MFC in a Static Libary"
Linker > Additional Dependencies: "Advapi32.lib" and "zlib.lib" (path
example with default installation: "C:\Programme\GnuWin32\lib\zlib.lib")
C/C++ > Preprocessor Definitions: "HAVE_LIBZ"
C/C++ > Additional Include Directories: C:\Programme\GnuWin32\include
-> Build

Now we have installed a PostgreSQL Server 9.3 on the same machine.

In Visual Studio we defined as "Command Arguments" the following:
"-h "localhost" -p 5432 -U postgres -f "C:\test.bak" -F c test"

Now start debugging and u will get the Heap corruption in Visual Studio.

Exactly u will get the following ASSERTION:

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: ...
File: dbgheap.c
Line: 1252

Expression: _CrtIsValidHeapPointer(pUserData)

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
---------------------------
Abbrechen Wiederholen Ignorieren
---------------------------

Which is caused from the Function "dumpFunc" at line 9942 ff.

...
free(funcsig);
...

Hope you can reproduce this Bug.
Is there a workaround we could use?

Regards

Benjamin

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Dashputre, Anurag (GE Healthcare) 2013-09-18 11:56:36 Known issues for PostgreSQL server 8.1.19
Previous Message Marcelo Bacha 2013-09-17 21:48:09 Postgis extension bug w/ OpenBSD