From f6ace4b7a2e681787ba99b544f974ec91cbc91a9 Mon Sep 17 00:00:00 2001 From: handa Date: Wed, 14 Jan 2009 07:42:22 +0000 Subject: [PATCH] (decode_coding_iso_2022): Check invocation status before updating charset0 and charset1. --- src/coding.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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: -- 1.7.10.4