Skip to content

Commit 0347d31

Browse files
committed
Oh, for crying in a bucket ... relax Assert so that glibc's strxfrm
does not dump core.
1 parent 59d9a37 commit 0347d31

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/backend/utils/adt/selfuncs.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.140 2003/07/17 20:52:36 tgl Exp $
18+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.141 2003/07/17 22:20:14 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -2700,11 +2700,16 @@ convert_string_datum(Datum value, Oid typid)
27002700
* However, it seems that some versions of Solaris have buggy
27012701
* strxfrm that can write past the specified buffer length in that
27022702
* scenario. So, do it the dumb way for portability.
2703+
*
2704+
* Yet other systems (e.g., glibc) sometimes return a smaller value
2705+
* from the second call than the first; thus the Assert must be <=
2706+
* not == as you'd expect. Can't any of these people program their
2707+
* way out of a paper bag?
27032708
*/
27042709
xfrmlen = strxfrm(NULL, val, 0);
27052710
xfrmstr = (char *) palloc(xfrmlen + 1);
27062711
xfrmlen2 = strxfrm(xfrmstr, val, xfrmlen + 1);
2707-
Assert(xfrmlen2 == xfrmlen);
2712+
Assert(xfrmlen2 <= xfrmlen);
27082713
pfree(val);
27092714
val = xfrmstr;
27102715
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy