PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15541
PG Version11.1
OSLinux
Opened2018-12-07 10:42:54+00
Reported byPan Bian
StatusOpen

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15541
Logged by:          Pan Bian
Email address:      (redacted)
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

Messages

DateAuthorSubject
2018-12-07 10:42:54+00=?utf-8?q?PG_Bug_reporting_form?=BUG #15541: Use after release in PQprint
2018-12-07 17:52:56+00Tom LaneRe: BUG #15541: Use after release in PQprint
2018-12-07 18:02:30+00Tom LaneRe: BUG #15541: Use after release in PQprint
2018-12-07 18:15:24+00Alvaro HerreraRe: BUG #15541: Use after release in PQprint
2018-12-07 18:25:25+00Tom LaneRe: BUG #15541: Use after release in PQprint