Skip site navigation (1) Skip section navigation (2)

Re: [BUGS] libpq causes segfault when share library unloaded

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jim Studt <jim(at)federated(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [BUGS] libpq causes segfault when share library unloaded
Date: 1999-11-05 01:16:38
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
Jim Studt <jim(at)federated(dot)com> writes:
> libpq will define an environment variable for PGCLIENTENCODING if
> none is specified.  If libpq is a shared library that is dynamically
> loaded, and it is subsequently unloaded then it leaves an entry in
> the environ array pointing into unmapped memory which will cause
> a segfault the next time the environment array is traversed.

Hmm.  Dynamically unloading a library can cause all sorts of problems,
of course, but the particular code you're complaining of is pretty
bletcherous anyway --- it's using a fixed-size buffer which seems mighty
risky.  I'm inclined to make it put the putenv() string into a malloc'd
buffer instead.  Would that solve the problem in your environment?

			regards, tom lane

pgsql-bugs by date

Next:From: bmarkDate: 1999-11-05 03:30:39
Subject: laser printer toner advertising
Previous:From: Jim StudtDate: 1999-11-04 17:02:22
Subject: libpq causes segfault when share library unloaded

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group