pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: zuming.jiang@inf.ethz.ch
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18276: Heap-buffer-overflow triggered in src/backend/utils/adt/datum.c:163
Date: Sun, 07 Jan 2024 14:16:59 -0500
Message-ID: <1633850.1704655019@sss.pgh.pa.us> (raw)
In-Reply-To: <18276-13b98d6ec97ed5b8@postgresql.org>
References: <18276-13b98d6ec97ed5b8@postgresql.org>

PG Bug reporting form <noreply@postgresql.org> writes:
> My fuzzer finds a heap-buffer-overflow bug in PostgreSQL 17devel, which
> makes PostgreSQL crash.

All I see here is a datatype declaration that doesn't match what the
C functions expect.  You wrote:

> CREATE TYPE widget (
>    input = widget_in,
>    output = widget_out,
>    alignment = double
> );

but the declaration that the regress.so functions expect is what's in
src/test/regress/sql/create_type.sql:

CREATE TYPE widget (
   internallength = 24,
   input = widget_in,
   output = widget_out,
   typmod_in = numerictypmodin,
   typmod_out = numerictypmodout,
   alignment = double
);

That is, widget_in expects it should produce a fixed-length Datum
(24 bytes long, with no length word).  But you declared the type
as variable-length, meaning that datumCopy expects to find a length
word.  That discrepancy leads directly to the reported crash.

			regards, tom lane





view thread (7+ messages)  latest in thread

Message-ID: <1633850.1704655019@sss.pgh.pa.us>
Permalink:  ../1633850.1704655019@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1633850.1704655019@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, zuming.jiang@inf.ethz.ch, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18276: Heap-buffer-overflow triggered in src/backend/utils/adt/datum.c:163
  In-Reply-To: <1633850.1704655019@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox