pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: a.kozhemyakin@postgrespro.ru
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18483: Segmentation fault in tests modules
Date: Tue, 11 Jun 2024 08:10:46 +0900
Message-ID: <ZmeH9lDIUWTsJ-Uk@paquier.xyz> (raw)
In-Reply-To: <d959bd09-3bce-6a5e-7ae0-dff761f8ad81@gmail.com>
References: <18483-30bfff42de238000@postgresql.org>
	<Zl5GS6SHBXRAkl_c@paquier.xyz>
	<219049.1717792376@sss.pgh.pa.us>
	<ZmOJ3jfeltZQnN_M@paquier.xyz>
	<439c9310-1d71-f2c6-b213-a9a2ea732ba9@gmail.com>
	<336833.1717859243@sss.pgh.pa.us>
	<250a21e5-d677-6b2a-2692-cd4233785e37@gmail.com>
	<ZmaUKZOmjv-L9EvK@paquier.xyz>
	<d959bd09-3bce-6a5e-7ae0-dff761f8ad81@gmail.com>

On Mon, Jun 10, 2024 at 11:00:00AM +0300, Alexander Lakhin wrote:
> 10.06.2024 08:50, Michael Paquier wrote:
>> On Sun, Jun 09, 2024 at 03:00:00PM +0300, Alexander Lakhin wrote:
>>> 2)
>>> echo "
>>> select test_enc_conversion('\x8bc68bcf8b', 'gb18030', 'gb18030', false);
>>> " >> src/test/regress/sql/conversion.sql
>>> TESTS="conversion" make -s check-tests
>>> 
>>> produces (under Valgrind):
>>> ==00:00:00:05.947 3320530== Invalid read of size 1
>>> ==00:00:00:05.947 3320530==    at 0x6F21E5: pg_gb18030_mblen (wchar.c:1000)
>>> ==00:00:00:05.947 3320530==    by 0x6F2BA0: pg_encoding_mblen (wchar.c:2072)
>>> ==00:00:00:05.947 3320530==    by 0x6B4EAF: report_invalid_encoding (mbutils.c:1700)
>>> ==00:00:00:05.947 3320530==    by 0x4867D3F: test_enc_conversion (regress.c:1154)
>>> ==00:00:00:05.947 3320530==    by 0x3B9796: ExecInterpExpr (execExprInterp.c:764)

So, valgrind is noisy here because the incomplete byte sequence
\x8b passed as input of the function after a valid byte sequence
causes pg_encoding_mblen() to return 2, which is 1 byte passed the end
of the actual string.  report_invalid_encoding() is careful to not
show any data passed in its input.  I am not really sure that this is
worth bothering with here, TBH.  As far as I know this is related to
the fact that we want test_enc_conversion() to be flexible enough to
accept any kind of input, working as a cheap shortcut to call these
internal encoding routines.  What do you think?

> My Valgrind-testing procedure is:
> git apply .../install-vrunner.patch # use the attached
> CPPFLAGS="-Og -DUSE_VALGRIND" ./configure -q && make -j8 -s

Thanks.  I was missing the -DUSE_VALGRIND.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (16+ messages)  latest in thread

Message-ID: <ZmeH9lDIUWTsJ-Uk@paquier.xyz>
Permalink:  ../ZmeH9lDIUWTsJ-Uk@paquier.xyz/
Also on:    postgresql.org/message-id/ZmeH9lDIUWTsJ-Uk@paquier.xyz

 · 

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: michael@paquier.xyz, exclusion@gmail.com, tgl@sss.pgh.pa.us, a.kozhemyakin@postgrespro.ru, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18483: Segmentation fault in tests modules
  In-Reply-To: <ZmeH9lDIUWTsJ-Uk@paquier.xyz>

* 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