\x output blowing up

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: \x output blowing up
Date: 2005-09-24 21:45:08
Message-ID: 20050924214502.GD25542@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Hi,

On CVS tip, whenever I do \x output, it dies with an internal error in
glibc on free. If you run it under valgrind, it complains about these
lines of code:

700 {
701 char *my_cell = pg_local_malloc(cell_w[i] + 1);
702
703 [Inv write 1 byte] strcpy(my_cell, *ptr);
704 if (opt_align[i % col_count] == 'r' && opt_numeric_locale)
705 format_numeric_locale(my_cell);
706 if (opt_border < 2)
707 fprintf(fout, "%s\n", my_cell);
708 else
709 [Inv read 1 byte] fprintf(fout, "%-s%*s |\n", my_cell, dwidth - cell_w[i], "");
710 free(my_cell);
711 }

Now, apart from the fact that the cell width != strlen in multibyte
encodings, there must be something else because this is just "select *
from pg_proc" and there are no multiple characters there AFAIK. I can't
see it though.

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2005-09-24 22:01:18 Re: Start translating
Previous Message Tom Lane 2005-09-24 21:19:47 Re: 64-bit API for large objects

Browse pgsql-patches by date

  From Date Subject
Next Message Martijn van Oosterhout 2005-09-24 22:13:40 Re: \x output blowing up
Previous Message Tom Lane 2005-09-24 17:13:00 Re: Proposed patch to clean up signed-ness warnings