Re: invalid memory alloc request size with extension url_decode - Mailing list pgsql-novice

From Tom Lane
Subject Re: invalid memory alloc request size with extension url_decode
Date
Msg-id 25644.1409236513@sss.pgh.pa.us
Whole thread Raw
In response to invalid memory alloc request size with extension url_decode  (Tobias Florek <postgres@ibotty.net>)
List pgsql-novice
Tobias Florek <postgres@ibotty.net> writes:
> for my untrained eye, the code [2] looks reasonable. it does use the
> following idiom though.

>    len = VARSIZE(in_text) - VARHDRSZ;

This would be okay except that the in_text value was extracted with
PG_GETARG_TEXT_PP rather than PG_GETARG_TEXT_P.  That allows the
value to be a short-header Datum, which this code is not prepared for.

You could either change the wrapper functions to use PG_GETARG_TEXT_P,
or fix the subroutines to use VARDATA_ANY and VARSIZE_ANY_EXHDR
when inspecting their text* arguments.

            regards, tom lane


pgsql-novice by date:

Previous
From: Tobias Florek
Date:
Subject: Re: invalid memory alloc request size with extension url_decode
Next
From: Keith
Date:
Subject: Re: PG 9.1 much slower than 8.2 ?