summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qxmlstream.g
Commit message (Collapse)AuthorAgeFilesLines
* Correct prefix reported for end element in QXmlStreamReaderVincent Baijot2021-04-201-0/+2
| | | | | | | | | | | | | | | | | | | Before this change, QXmlStreamReader prefix value was always an empty string for EndElement when the documentation state : "Returns the prefix of a StartElement or EndElement." The error was a missing update of the prefix value when parsing EndElement. I updated the tests data which were also wrong because no prefix were reported even for </a:foo>. No new test is necessary, I think, the test data already cover the cases of EndElement with a prefix and without one (unchanged here). Fixes: QTBUG-86847 Pick-to: 5.15 6.0 6.1 Change-Id: I0ad38b9741d760f1ce688a36f969ec14e20a928c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QXmlStreamReader: don't store pointersMÃ¥rten Nordheim2020-11-111-6/+9
| | | | | | | | | | | | | They were pointing into the QHash structure which could be invalidated on insert if growing was needed. This caused some user-after-free issues. Indexing into the QHash is quite fast, so let's just store the name and a pointer to the QHash to do that. Fixes: QTBUG-88246 Change-Id: If7f9b1c6ea7557c5bd0869b42b1b84aa824cc6ce Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port QXmlStreamReader from QStringRef to QStringViewKarsten Heimrich2020-08-191-16/+16
| | | | | | | | | | | Use the new QtPrivate::XmlString class as the container holding the string data internally. It basically a "QStringRef lite", purely used in the implemntation. This replaces all usages of QStringRef in the parser. Fixes: QTBUG-84318 Change-Id: I557bbc6831301866602586d11d53283affd034a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Refactor qxmlstream_p.hLars Knoll2020-08-191-401/+77
| | | | | | | | | | Pull the file apart, so that the parts generated from qxmlstream.g are separated from the definition of the private class. This will in the future simplify maintenance and refactoring. Change-Id: I4a9c1bb1e377dee1e6d3b9aa9b0dfa64c5806c45 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Get rid of the QTextCodec dependency in QXmlStreamReaderLars Knoll2020-05-141-7/+3
| | | | | | | | | | | | Use QStringDecoder to convert the data instead. [ChangeLog][Important Behavior Changes] QXmlStreamWriter always encodes XML in UTF-8, and QXmlStreamReader is limited to XML files encoded in Unicode encodings (UTF-8, UTF-16 and UTF-32) and latin1 (ISO-8859-1). Change-Id: I10da612b951f4312ddaf63a89587697777dd8dc1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStreamReader: port Private::put...() to QStringViewMarc Mutz2020-05-111-10/+6
| | | | | | | | This enables the use of QChar::fromUcs4() instead of QString::fromUcs4() in a call to putStringLiteral(). Change-Id: I6ed933cc92bfbb70ed2b168b7deeeb466bc6bfeb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStreamSimpleStack: port to qsizetypeMarc Mutz2020-05-111-7/+7
| | | | | Change-Id: Ie4ea7ca83dc1870d1a4a4cfbe4447b5d971b33bf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Adapt qxmlstream.g to older changes to qxmlstream_p.hMarc Mutz2020-05-101-2/+2
| | | | | Change-Id: I35c0700ed29d756949b95c3a26fdf9f087b5ef1c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStream: use more ranged for loopsMarc Mutz2020-05-101-0/+9
| | | | | | | | | More compact and isolates against decltype(size()) issues. Had to make QXmlStreamSimpleStack iterable. Change-Id: Icfa7b2ab09995c7a442fd8a5b2f5d6ce90120822 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QXmlStreamReader: avoid double QHash lookupsMarc Mutz2020-05-101-6/+6
| | | | | | | | | | | | | | | | | | | Replace if (hash.contains(x)) { // lookup #1 ~~~ hash[x]; // lookup #2 with if (auto it = hash.find(x); it != hash.end()) { // lookup ~~~ *it; // no lookup halving the number of QHash lookups. The container is not shared, so there's no danger of a detach when going directly to the non-const function. Change-Id: Ifae409f98e0be972b31a24326ad548723831fda8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Add an expansion limit for entitiesLars Knoll2020-02-261-1/+13
| | | | | | | | | | | | | | | | | | | | | Recursively defined entities can easily exhaust all available memory. Limit entity expansion to a default of 4096 characters to avoid DoS attacks when a user loads untrusted content. Added a setter and getter to allow modifying the expansion limit. [ChangeLog][QtCore][QXmlStream] QXmlStreamReader does now by default limit the expansion of entities to 4096 characters. Documents where a single entity expands to more characters than the limit are not considered well formed. The limit is there to avoid DoS attacks through recursively expanding entities when loading untrusted content. The limit can be changed through the QXmlStreamReader::setEntityExpansionLimit() method. Fixes: QTBUG-47417 Change-Id: I94387815d74fcf34783e136387ee57fac5ded0c9 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Move away from using 0 as a pointer constantAllan Sandfeld Jensen2019-06-071-1/+1
| | | | | | | | | Cleans up most of corelib to use nullptr or default enums where appropriate. Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update qxmlstream.g with changes from qxmlstream_p.hLars Knoll2019-01-251-3/+11
| | | | | | | | | | | Some updates that made it into qxmlstream_p.h have not been reflected in qxmlstream.g. Also fix the expected amount of shift/reduce conflicts. Fixes: QTBUG-60186 Change-Id: I2a5e1c579dbbe8812a75ca6bb1e3a6a0ba909cdf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Modernize the "textcodec" featureLiang Qi2018-11-071-2/+2
| | | | | | | | | Also clean up QTextCodec usage in qmake build and some includes of qtextcodec.h. Change-Id: I0475b82690024054add4e85a8724c8ea3adcf62a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Create corelib/serialization and move existing file formats into itThiago Macieira2018-01-261-0/+1852
This is in preparation to adding CBOR support. We don't need yet another dir for CBOR and placing it in src/corelib/json is just wrong. Change-Id: I9741f017961b410c910dfffd14ffb9d870340fa6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>