Re: PostgreSQL 18 beta1 - Segmentation fault on custom type casting

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Thai <thomas(dot)t(dot)thai(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: PostgreSQL 18 beta1 - Segmentation fault on custom type casting
Date: 2025-07-10 14:55:13
Message-ID: 1525420.1752159313@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thomas Thai <thomas(dot)t(dot)thai(at)gmail(dot)com> writes:
> PostgreSQL 18 beta crashes with a segmentation fault when casting strings
> to custom types. The crash occurs specifically in PostgreSQL's type-casting
> system, not in extension code.

The reason you're having a problem is that this is not a valid way to
store a custom type. The representation has to be a single blob of
memory [1], and it has to be represented in a way that lets
type-independent code determine its length. Typically that means
following the varlena-header rules.

regards, tom lane

[1] Well, there is a notion of an "expanded" representation that
doesn't have to be a flat blob. But you're not following the
rules for that either.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Anthony Hsu 2025-07-10 22:36:34 Re: BUG #18961: Race scenario where max_standby_streaming_delay is not honored
Previous Message Tom Lane 2025-07-10 14:41:30 Re: Starting a PostgreSQL server on a dynamic port (parameter port=0)