Port Bug Report: Backend crashes when comparisons are made to NULL values with certain types - Mailing list pgsql-ports

From Unprivileged user
Subject Port Bug Report: Backend crashes when comparisons are made to NULL values with certain types
Date
Msg-id 199901122144.QAA04835@hub.org
Whole thread Raw
List pgsql-ports
============================================================================
                        POSTGRESQL BUG REPORT TEMPLATE
============================================================================


Your name        : Mark Volpe
Your email address    : mvolpe@eos.ncsu.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;


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


pgsql-ports by date:

Previous
From: Unprivileged user
Date:
Subject: Port Bug Report: IRIX libpq++ namespace problem
Next
From: Unprivileged user
Date:
Subject: Port Bug Report: pg_dump generates schema with wrong SQL syntax in version 6.32