QXmlStreamReader: early return in case of malformed attributes
There's no point at keep raising errors after encountering the first malformed attribute. Change-Id: Idb37e577ea96c3bd850b3caf008fe3ecd57dd32e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
474a5e2f3f
commit
4d8a515a23
@ -50,6 +50,7 @@
|
||||
#endif
|
||||
#include <qstack.h>
|
||||
#include <qbuffer.h>
|
||||
#include <qscopeguard.h>
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#include <qcoreapplication.h>
|
||||
#else
|
||||
@ -1582,6 +1583,7 @@ QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix)
|
||||
*/
|
||||
void QXmlStreamReaderPrivate::resolveTag()
|
||||
{
|
||||
const auto attributeStackCleaner = qScopeGuard([this](){ attributeStack.clear(); });
|
||||
int n = attributeStack.size();
|
||||
|
||||
if (namespaceProcessing) {
|
||||
@ -1649,7 +1651,10 @@ void QXmlStreamReaderPrivate::resolveTag()
|
||||
if (attributes[j].name() == attribute.name()
|
||||
&& attributes[j].namespaceUri() == attribute.namespaceUri()
|
||||
&& (namespaceProcessing || attributes[j].qualifiedName() == attribute.qualifiedName()))
|
||||
{
|
||||
raiseWellFormedError(QXmlStream::tr("Attribute '%1' redefined.").arg(attribute.qualifiedName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1680,8 +1685,6 @@ void QXmlStreamReaderPrivate::resolveTag()
|
||||
attribute.m_isDefault = true;
|
||||
attributes.append(attribute);
|
||||
}
|
||||
|
||||
attributeStack.clear();
|
||||
}
|
||||
|
||||
void QXmlStreamReaderPrivate::resolvePublicNamespaces()
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user