[PATCH v1] PL/Perl: Fix NULL deref for forged array

Xing Guo <higuoxing@gmail.com>

From: Xing Guo <higuoxing@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Date: 2026-06-23T06:46:44Z
Lists: pgsql-hackers

Attachments

Hi hackers,

A PL/Perl function returning a forged PostgreSQL::InServer::ARRAY
object (e.g., an empty hash blessed as that class) could cause a
segfault. This occurs because hv_fetch_string returns NULL pointer
when the "array" key is missing, and the code previously dereferenced
it without checking if the pointer itself was NULL.

The attachment is the patch for fixing it.

Best Regards,
Xing

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. plperl: Fix NULL pointer dereference for forged array object