diff options
author | Honglei Zhang <honglei.zhang@nokia.com> | 2011-08-19 08:22:38 (GMT) |
---|---|---|
committer | Honglei Zhang <honglei.zhang@nokia.com> | 2011-08-24 10:23:55 (GMT) |
commit | e8b49d0e33ea6c8a2814fcad70015dbcc28e9a5d (patch) | |
tree | 3297440a8bf574560aa5deb71c1b11e0cad0802a /src/xml | |
parent | 89260bad8fddcbbfe54b3c5238ef370a620ab9e6 (diff) | |
download | Qt-e8b49d0e33ea6c8a2814fcad70015dbcc28e9a5d.zip Qt-e8b49d0e33ea6c8a2814fcad70015dbcc28e9a5d.tar.gz Qt-e8b49d0e33ea6c8a2814fcad70015dbcc28e9a5d.tar.bz2 |
QXmlSimpleReader handle external entity reference file over 1k
This commit fixes the bug that causes the QXmlSimpleReader can only handle
external reference file less than 1k. Instead of reading the 1k buffer,
the system will try to read all data from file into memory. This is not
good for memory management. But there doesn't seem to be better solution
without breaking the existing API.
Task-number: QTBUG-21025
Reviewed-by: Peter Hartmann
Diffstat (limited to 'src/xml')
-rw-r--r-- | src/xml/sax/qxml.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 2f5384b..0c7f2ab 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -7748,7 +7748,13 @@ bool QXmlSimpleReaderPrivate::processReference() return false; } if (ret) { - QString xmlRefString = ret->data(); + QString xmlRefString; + QString buffer = ret->data(); + while (buffer.length()>0){ + xmlRefString += buffer; + ret->fetchData(); + buffer = ret->data(); + } delete ret; if (!stripTextDecl(xmlRefString)) { reportParseError(QLatin1String(XMLERR_ERRORINTEXTDECL)); |