pgsql: Avoid possibly accessing off the end of memory in SJIS2004 conve

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid possibly accessing off the end of memory in SJIS2004 conve
Date: 2011-09-06 18:53:29
Message-ID: E1R10m1-0000hH-7e@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid possibly accessing off the end of memory in SJIS2004 conversion.

The code in shift_jis_20042euc_jis_2004() would fetch two bytes even when
only one remained in the string. Since conversion functions aren't
supposed to assume null-terminated input, this poses a small risk of
fetching past the end of memory and incurring SIGSEGV. No such crash has
been identified in the field, but we've certainly seen the equivalent
happen in other code paths, so patch this one all the way back.

Report and patch by Noah Misch.

Branch
------
REL8_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/1f036c3f8a1aa80182037f2fb0706c0270b0492d

Modified Files
--------------
.../euc_jis_2004_and_shift_jis_2004.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2011-09-06 19:18:20 Re: [COMMITTERS] pgsql: Clean up the #include mess a little.
Previous Message Tom Lane 2011-09-06 18:38:37 pgsql: Avoid possibly accessing off the end of memory in examine_attrib