patch to disallow zero length paths in binary (minor bug fix)

From: "Merlin Moncure" <mmoncure(at)gmail(dot)com>
To: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: patch to disallow zero length paths in binary (minor bug fix)
Date: 2007-12-17 20:17:17
Message-ID: b42b73150712171217p7d8b9858n51d593146f43df82@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hackers,

Following is a patch to force the path type not to accept a path with
zero points. This appears to be illegal in the parser, but possible
when sending a well formed packed in binary with zero points. The old
behavior was this:

ERROR: floating-point exception
DETAIL: An invalid floating-point operation was signaled. This probably
means an out-of-range result or an invalid operation, such as division
by zero.

now it should properly display the points out of range error

merlin
eSilo

Index: src/backend/utils/adt/geo_ops.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v
retrieving revision 1.97
diff -r1.97 geo_ops.c
1459c1459
< if (npts < 0 || npts >= (int32) ((INT_MAX - offsetof(PATH, p[0]))
/ sizeof(Point)))
---
> if (npts <= 0 || npts >= (int32) ((INT_MAX - offsetof(PATH, p[0])) / sizeof(Point)))

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-12-17 22:25:24 Re: patch to disallow zero length paths in binary (minor bug fix)
Previous Message Gokulakannan Somasundaram 2007-12-17 18:35:43 Re: Proposal for Null Bitmap Optimization(for TrailingNULLs)