Fix for fragile code in hashtext()
This is in the ICU-only non-deterministic collation path, so I don't
believe there's an actual bug or results change here. But for libc, it
would have been incorrect.
Regards,
Jeff Davis
On Tue, Aug 18, 2026 at 2:45 PM Jeff Davis <pgsql@j-davis.com> wrote:
This is in the ICU-only non-deterministic collation path, so I don't
believe there's an actual bug or results change here. But for libc, it
would have been incorrect.Regards,
Jeff Davis
The fix looks right to me.
Perhaps the pg_strnxfrm() comment could state more explicitly that the
first call
is only for buffer sizing, while the return value from the actual
transformation is
the authoritative result length. That seems to be the assumption that was
missed
here.
I don’t think a regression test is necessary unless there’s a simple way to
exercise
rsize < bsize; an ICU test would pass both before and after this patch.
Regards,
Haibo
On Wed, 2026-08-19 at 01:14 -0700, Haibo Yan wrote:
Perhaps the pg_strnxfrm() comment could state more explicitly that
the first call
is only for buffer sizing, while the return value from the actual
transformation is
the authoritative result length. That seems to be the assumption that
was missed
here.
Done, and committed. Thank you!
Regards,
Jeff Davis