Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz> writes:
> I found some problem with PG_RETURN_TEXT_P.
Fix your code to not scribble on memory that doesn't belong to it,
and all will be well. I can see at least two buffer-overrun bugs,
and there may be more:
txtn = (text *) palloc (ma); -- forgot to add VARHDRSZ
strcpy (*str_pointer, str); -- copies one byte too many
regards, tom lane