Skip to content

Commit

Permalink
Fix possible heap corruption in QXmlStream
Browse files Browse the repository at this point in the history
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 <rich@kde.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
  • Loading branch information
Allan Sandfeld Jensen committed Aug 13, 2018
1 parent 6854fa7 commit 6256729
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/corelib/serialization/qxmlstream_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,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];
Expand Down

0 comments on commit 6256729

Please sign in to comment.