Port Bug Report: Backend crashes when comparisons are made to NULL values with certain types

From: Unprivileged user <nobody>
To: pgsql-ports(at)postgresql(dot)org
Subject: Port Bug Report: Backend crashes when comparisons are made to NULL values with certain types
Date: 1999-01-12 21:44:29
Message-ID: 199901122144.QAA04835@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports


============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : Mark Volpe
Your email address : mvolpe(at)eos(dot)ncsu(dot)edu

Category : runtime: back-end
Severity : serious

Summary: Backend crashes when comparisons are made to NULL values with certain types

System Configuration
--------------------
Operating System : Digital Unix version 4.0

PostgreSQL version : 6.2

Compiler used : gcc 2.7.2

Hardware:
---------
Digital alphaserver 128MB
> uname -a
OSF1 nts1.rtp.epa.gov V4.0 564 alpha

Versions of other tools:
------------------------

--------------------------------------------------------------------------

Problem Description:
--------------------
Some data types, most notably inet, cidr, and macaddr, are
missing null pointer checks in their comparison functions.
If I try to compare NULL values it crashes the backend.
See the example below.

--------------------------------------------------------------------------

Test Case:
----------
CREATE TABLE test ( ip inet );
INSERT INTO test VALUES ( NULL );
SELECT * FROM test WHERE ( ip = '10.20.30.40' );
-- Backend crashes with memory fault

--------------------------------------------------------------------------

Solution:
---------
Add the null pointer check at the beginning of any function
related to the datatype. Most of the other datatypes
user something like this:

if (arg1==NULL || arg2==NULL) return FALSE;

--------------------------------------------------------------------------

Browse pgsql-ports by date

  From Date Subject
Next Message Unprivileged user 1999-01-13 15:32:45 Port Bug Report: pg_dump generates schema with wrong SQL syntax in version 6.32
Previous Message Unprivileged user 1999-01-12 16:27:20 Port Bug Report: IRIX libpq++ namespace problem