mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Relax check for return value from second call of pg_strnxfrm().
strxfrm() is not guaranteed to return the exact number of bytes needed to store the result; it may return a higher value. Discussion: https://postgr.es/m/32f85d88d1f64395abfe5a10dd97a62a4d3474ce.camel@j-davis.com Reviewed-by: Heikki Linnakangas Backpatch-through: 16
This commit is contained in:
@@ -298,7 +298,9 @@ hashtext(PG_FUNCTION_ARGS)
|
||||
buf = palloc(bsize + 1);
|
||||
|
||||
rsize = pg_strnxfrm(buf, bsize + 1, keydata, keylen, mylocale);
|
||||
if (rsize != bsize)
|
||||
|
||||
/* the second call may return a smaller value than the first */
|
||||
if (rsize > bsize)
|
||||
elog(ERROR, "pg_strnxfrm() returned unexpected result");
|
||||
|
||||
/*
|
||||
@@ -352,7 +354,9 @@ hashtextextended(PG_FUNCTION_ARGS)
|
||||
buf = palloc(bsize + 1);
|
||||
|
||||
rsize = pg_strnxfrm(buf, bsize + 1, keydata, keylen, mylocale);
|
||||
if (rsize != bsize)
|
||||
|
||||
/* the second call may return a smaller value than the first */
|
||||
if (rsize > bsize)
|
||||
elog(ERROR, "pg_strnxfrm() returned unexpected result");
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user