From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: bianpan2016@163.com
Subject: BUG #15541: Use after release in PQprint
Date: Fri, 07 Dec 2018 10:42:54 +0000
Message-ID: <15541-c835d8b9a903f7ad@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15541
Logged by: Pan Bian
Email address: bianpan2016@163.com
PostgreSQL version: 11.1
Operating system: Linux
Description:
File: src/interfaces/libpq/fe-print.c
Function: PQprint
Issue details:
The function PQprint releases the file hander fout via pclose or _pclose
when usePipe is true. After that, fout is used again to write message
"fputs("</table>\n", fout);".
For your convenience, I copy-and-paste related code as follows.
67 void
68 PQprint(FILE *fout, const PGresult *res, const PQprintOpt *po)
69 {
...
310 if (usePipe)
311 {
312 #ifdef WIN32
313 _pclose(fout);
314 #else
315 pclose(fout);
316
317 #ifdef ENABLE_THREAD_SAFETY
318 /* we can't easily verify if EPIPE occurred, so say it did
*/
319 if (sigpipe_masked)
320 pq_reset_sigpipe(&osigset, sigpipe_pending, true);
321 #else
322 pqsignal(SIGPIPE, oldsigpipehandler);
323 #endif /* ENABLE_THREAD_SAFETY */
324 #endif /* WIN32 */
325 }
326 if (po->html3 && !po->expanded)
327 fputs("</table>\n", fout);
328 }
329 }
Thank you,
Pan Bian
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, bianpan2016@163.com
Subject: Re: BUG #15541: Use after release in PQprint
In-Reply-To: <15541-c835d8b9a903f7ad@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox