Re: Question about Encoding a Custom Type - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Question about Encoding a Custom Type
Date
Msg-id 20080616184158.GH4792@svana.org
Whole thread Raw
In response to Re: Question about Encoding a Custom Type  ("David E. Wheeler" <david@kineticode.com>)
Responses Re: Question about Encoding a Custom Type  ("David E. Wheeler" <david@kineticode.com>)
List pgsql-hackers
On Mon, Jun 16, 2008 at 01:29:33PM -0500, David E. Wheeler wrote:
> >Smells like uninitialized-memory problems to me.  Perhaps you are
> >miscalculating the length of the input data?
>
> Entirely possible. Here are the two functions in which I calculate size:

Actually, real dumb question but: arn't you assume that text* values
are NULL terminated, because they're not...
>
> char * cilower(text * arg) {
>     // Do I need to free anything here?
>     char * str = VARDATA_ANY( arg );

str here is not null terminated. You need text_to_cstring or something
similar.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

pgsql-hackers by date:

Previous
From: Robert Treat
Date:
Subject: Re: How to Sponsor a Feature
Next
From: Robert Treat
Date:
Subject: Re: Crash in pgCrypto?