From: Allan Sandfeld Jensen Date: Mon, 13 Aug 2018 13:29:16 +0000 (+0200) Subject: [PATCH] Fix possible heap corruption in QXmlStream X-Git-Tag: archive/raspbian/4%4.8.7+dfsg-18+rpi1+deb10u2^2~63 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=44b4ee62f847f23eefd6467acedc8dc415cbb4bc;p=qt4-x11.git [PATCH] Fix possible heap corruption in QXmlStream The value of 'tos' at the check might already be on the last element, so triggering stack expansion on the second last element is too late. Change-Id: Ib3ab2662d4d27a71effe9e988b9e172923af2908 Reviewed-by: Richard J. Moore Reviewed-by: Thiago Macieira Gbp-Pq: Name CVE-2018-15518.patch --- diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 3539e1b7b..f637e2d5a 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -1242,7 +1242,7 @@ bool QXmlStreamReaderPrivate::parse() state_stack[tos] = 0; return true; } else if (act > 0) { - if (++tos == stack_size-1) + if (++tos >= stack_size-1) reallocateStack(); Value &val = sym_stack[tos];