Re: Question about Encoding a Custom Type

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question about Encoding a Custom Type
Date: 2008-06-16 18:41:58
Message-ID: 20080616184158.GH4792@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2008-06-16 18:48:42 Re: Crash in pgCrypto?
Previous Message Robert Treat 2008-06-16 18:41:23 Re: How to Sponsor a Feature