Обсуждение: Port Bug Report: Backend crashes when comparisons are made to NULL values with certain types
Port Bug Report: Backend crashes when comparisons are made to NULL values with certain types
От
Unprivileged user
Дата:
============================================================================ 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; --------------------------------------------------------------------------