Re: Infinity bsearch crash on Windows - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Infinity bsearch crash on Windows
Date
Msg-id BANLkTi=3gEMxbA=Safnd010Kjk9FaFmTdg@mail.gmail.com
Whole thread Raw
In response to Infinity bsearch crash on Windows  (Greg Smith <greg@2ndQuadrant.com>)
List pgsql-hackers
On 10 May 2011 23:02, Greg Smith <greg@2ndquadrant.com> wrote:
> Why crash there only on Windows?  Was the problem actually introduced above
> this part of the code?  These are all questions I have no answer for.

I don't find it at all surprising that there's a memory corruption bug
that only manifests itself on Windows. Recently, I reported a bug in
pgAdmin that turned out to be a simple case of forgetting to allocate
an extra byte of memory for a null in a c string. The outward problem
couldn't be reproduced on Mac - it only occurred on Linux. Of course,
the problem with undefined behaviour is not that it might cause your
program to crash, but that it might not cause your program to crash.

For debug builds, Visual C++ allocates "no man's land" guard bytes on
either side of areas of allocated memory, which is great for catching
heap corruption bugs. My guess is that when the VC++ debugger issues a
breakpoint, that's exactly where the memory is being
corrupted/improperly dereferenced.


--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


pgsql-hackers by date:

Previous
From: "MauMau"
Date:
Subject: Re: Feature proposal: distinguish each PostgreSQL instance in the event log
Next
From: Tom Lane
Date:
Subject: Re: Feature proposal: distinguish each PostgreSQL instance in the event log