From db5529150b89269569b636235ef5371ea08358d6 Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 21 Mar 2002 13:27:59 +0000 Subject: [PATCH] fixed a bug in the ISO-Latin 1 to UTF8 encoder raised by Morus Walter * encoding.c: fixed a bug in the ISO-Latin 1 to UTF8 encoder raised by Morus Walter Daniel --- ChangeLog | 5 +++++ encoding.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 305da87a..2f0fcf02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Mar 21 14:25:29 CET 2002 Daniel Veillard + + * encoding.c: fixed a bug in the ISO-Latin 1 to UTF8 encoder + raised by Morus Walter + Thu Mar 21 14:07:13 CET 2002 Daniel Veillard * xmlcatalog.c include/libxml/xmlversion.h.in: applied 2 fixups diff --git a/encoding.c b/encoding.c index df8714be..8e2397a2 100644 --- a/encoding.c +++ b/encoding.c @@ -577,9 +577,13 @@ isolat1ToUTF8(unsigned char* out, int *outlen, processed++; continue; } else { - *out++= ((c >> 6) & 0x1F) | 0xC0; - if (out >= outend) + /* + * make sure there is 2 chars left in advance + */ + if (out + 1 >= outend) { break; + } + *out++= ((c >> 6) & 0x1F) | 0xC0; *out++= (c & 0x3F) | 0x80; processed++; }