Re: pgsql: With GB18030, prevent SIGSEGV from reading past end of allocatio

From: Noah Misch <noah(at)leadboat(dot)com>
To: sean <zoulx1982(at)163(dot)com>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: With GB18030, prevent SIGSEGV from reading past end of allocatio
Date: 2025-05-16 03:11:00
Message-ID: 20250516031100.8c.nmisch@google.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Wed, May 14, 2025 at 04:38:06PM +0800, sean wrote:
> I read the patch you commit to pgsql, and i found there also some other routine which
> will still call pg_encoding_mblen to get char length.
> I have no idea why these routine don't have to replaced by call pg_encoding_mblen_or_incomplete?

See the pg_encoding_mblen() header comment for the rules on when calling it is
okay. For example, it's okay for NUL-terminated input.

> And how can i do to reproduce this crash?

The patch-added test cases provide some indication on how to reproduce the
crash.

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2025-05-16 15:44:32 pgsql: Align organization wording in copyright statement
Previous Message Richard Guo 2025-05-15 08:28:40 pgsql: Fix Assert failure in XMLTABLE parser