From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix latent crash in do_text_output_multiline(). |
Date: | 2016-05-23 18:17:01 |
Message-ID: | E1b4uPV-0002Nb-4U@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix latent crash in do_text_output_multiline().
do_text_output_multiline() would fail (typically with a null pointer
dereference crash) if its input string did not end with a newline. Such
cases do not arise in our current sources; but it certainly could happen
in future, or in extension code's usage of the function, so we should fix
it. To fix, replace "eol += len" with "eol = text + len".
While at it, make two cosmetic improvements: mark the input string const,
and rename the argument from "text" to "txt" to dodge pgindent strangeness
(since "text" is a typedef name).
Even though this problem is only latent at present, it seems like a good
idea to back-patch the fix, since it's a very simple/safe patch and it's
not out of the realm of possibility that we might in future back-patch
something that expects sane behavior from do_text_output_multiline().
Per report from Hao Lee.
Report: <CAGoxFiFPAGyPAJLcFxTB5cGhTW2yOVBDYeqDugYwV4dEd1L_Ag(at)mail(dot)gmail(dot)com>
Branch
------
REL9_5_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/9d91cd865bdc52ee2ebe70447be582fabfe88664
Modified Files
--------------
src/backend/executor/execTuples.c | 19 +++++++++----------
src/include/executor/executor.h | 2 +-
2 files changed, 10 insertions(+), 11 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-05-23 23:08:55 | pgsql: Add support for more extensive testing of raw_expression_tree_wa |
Previous Message | Peter Eisentraut | 2016-05-22 02:17:18 | pgsql: psql: Message style improvements |