From: handa Date: Wed, 14 Jan 2009 07:42:22 +0000 (+0000) Subject: (decode_coding_iso_2022): Check invocation status X-Git-Tag: REL-1-5-4~16 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6ace4b7a2e681787ba99b544f974ec91cbc91a9;p=m17n%2Fm17n-lib.git (decode_coding_iso_2022): Check invocation status before updating charset0 and charset1. --- diff --git a/src/coding.c b/src/coding.c index 6f5a9c9..10e0725 100644 --- a/src/coding.c +++ b/src/coding.c @@ -1754,8 +1754,10 @@ decode_coding_iso_2022 (const unsigned char *source, int src_bytes, MText *mt, else goto invalid_byte; /* We must update these variables now. */ - charset0 = status->designation[status->invocation[0]]; - charset1 = status->designation[status->invocation[1]]; + if (status->invocation[0] >= 0) + charset0 = status->designation[status->invocation[0]]; + if (status->invocation[1] >= 0) + charset1 = status->designation[status->invocation[1]]; continue; case 'n': /* invocation of locking-shift-2 */ @@ -1907,8 +1909,10 @@ decode_coding_iso_2022 (const unsigned char *source, int src_bytes, MText *mt, else goto invalid_byte; /* We must update these variables now. */ - charset0 = status->designation[status->invocation[0]]; - charset1 = status->designation[status->invocation[1]]; + if (status->invocation[0] >= 0) + charset0 = status->designation[status->invocation[0]]; + if (status->invocation[1] >= 0) + charset1 = status->designation[status->invocation[1]]; continue; unused_escape_sequence: