diff --git a/ChangeLog b/ChangeLog index 80c0bfa6..feaec706 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Feb 9 13:41:47 CET 2004 Daniel Veillard + + * encoding.c: applied a small patch from Alfred Mickautsch + to avoid an out of bound error in isolat1ToUTF8() + Mon Feb 9 13:35:50 CET 2004 Daniel Veillard * xinclude.c: remove the warning on the 2001 namespace diff --git a/encoding.c b/encoding.c index 928f3afa..7ee072e4 100644 --- a/encoding.c +++ b/encoding.c @@ -235,28 +235,23 @@ isolat1ToUTF8(unsigned char* out, int *outlen, unsigned char* outend = out + *outlen; const unsigned char* inend; const unsigned char* instop; - xmlChar c = *in; inend = in + (*inlen); instop = inend; while (in < inend && out < outend - 1) { - if (c >= 0x80) { - *out++= ((c >> 6) & 0x1F) | 0xC0; - *out++= (c & 0x3F) | 0x80; + if (*in >= 0x80) { + *out++ = (((*in) >> 6) & 0x1F) | 0xC0; + *out++ = ((*in) & 0x3F) | 0x80; ++in; - c = *in; } if (instop - in > outend - out) instop = in + (outend - out); - while (c < 0x80 && in < instop) { - *out++ = c; - ++in; - c = *in; + while (in < instop && *in < 0x80) { + *out++ = *in++; } } - if (in < inend && out < outend && c < 0x80) { - *out++ = c; - ++in; + if (in < inend && out < outend && *in < 0x80) { + *out++ = *in++; } *outlen = out - outstart; *inlen = in - base;