mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
applied a small patch from Alfred Mickautsch to avoid an out of bound
* encoding.c: applied a small patch from Alfred Mickautsch to avoid an out of bound error in isolat1ToUTF8() Daniel
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Mon Feb 9 13:41:47 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* 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 <daniel@veillard.com>
|
Mon Feb 9 13:35:50 CET 2004 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* xinclude.c: remove the warning on the 2001 namespace
|
* xinclude.c: remove the warning on the 2001 namespace
|
||||||
|
19
encoding.c
19
encoding.c
@@ -235,28 +235,23 @@ isolat1ToUTF8(unsigned char* out, int *outlen,
|
|||||||
unsigned char* outend = out + *outlen;
|
unsigned char* outend = out + *outlen;
|
||||||
const unsigned char* inend;
|
const unsigned char* inend;
|
||||||
const unsigned char* instop;
|
const unsigned char* instop;
|
||||||
xmlChar c = *in;
|
|
||||||
|
|
||||||
inend = in + (*inlen);
|
inend = in + (*inlen);
|
||||||
instop = inend;
|
instop = inend;
|
||||||
|
|
||||||
while (in < inend && out < outend - 1) {
|
while (in < inend && out < outend - 1) {
|
||||||
if (c >= 0x80) {
|
if (*in >= 0x80) {
|
||||||
*out++= ((c >> 6) & 0x1F) | 0xC0;
|
*out++ = (((*in) >> 6) & 0x1F) | 0xC0;
|
||||||
*out++= (c & 0x3F) | 0x80;
|
*out++ = ((*in) & 0x3F) | 0x80;
|
||||||
++in;
|
++in;
|
||||||
c = *in;
|
|
||||||
}
|
}
|
||||||
if (instop - in > outend - out) instop = in + (outend - out);
|
if (instop - in > outend - out) instop = in + (outend - out);
|
||||||
while (c < 0x80 && in < instop) {
|
while (in < instop && *in < 0x80) {
|
||||||
*out++ = c;
|
*out++ = *in++;
|
||||||
++in;
|
|
||||||
c = *in;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (in < inend && out < outend && c < 0x80) {
|
if (in < inend && out < outend && *in < 0x80) {
|
||||||
*out++ = c;
|
*out++ = *in++;
|
||||||
++in;
|
|
||||||
}
|
}
|
||||||
*outlen = out - outstart;
|
*outlen = out - outstart;
|
||||||
*inlen = in - base;
|
*inlen = in - base;
|
||||||
|
Reference in New Issue
Block a user