Bug in fd.c (FreeFile)

From: Claudio Natoli <claudio(dot)natoli(at)memetrics(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Bug in fd.c (FreeFile)
Date: 2003-11-26 01:34:09
Message-ID: A02DEC4D1073D611BAE8525405FCCE2B028047@harris.memetrics.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


I believe FreeFile has an "off by one" type error. Apart from possibly
accessing past the end of the array, when combined with the while loop call
from CleanupTempFiles, it contrives to fail to fclose a number of files [at
a guess, floor((numAllocatedFiles-1)/2)] when CleanupTempFiles is called
(unless I'm completely mistaken).

Change 1: Begin search from "correct" [logical] final element of array
Change 2: Minor speed-up to CleanupTempFiles (knowing that FreeFile iterates
from the [logical]
final element of the array)

Apply to HEAD (bug also exists in 7.4 branch, possibly others...)

Cheers,
Claudio

---
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>

Attachment Content-Type Size
fd.c.patch application/octet-stream 1.0 KB

Browse pgsql-patches by date

  From Date Subject
Next Message Claudio Natoli 2003-11-26 01:37:18 Re: Bug in fd.c (FreeFile)
Previous Message Christopher Kings-Lynne 2003-11-26 01:30:21 Re: minor cleanup in plpgsql.sgml