pgsql: Avoid possibly accessing off the end of memory in SJIS2004 conve - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Avoid possibly accessing off the end of memory in SJIS2004 conve
Date
Msg-id E1R10m1-0000hB-84@gemulon.postgresql.org
Whole thread Raw
List 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
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8b81b99b89de186aeda9baabf4e1b6bd792d54b9

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


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Avoid possibly accessing off the end of memory in SJIS2004 conve
Next
From: Tom Lane
Date:
Subject: pgsql: Avoid possibly accessing off the end of memory in SJIS2004 conve