summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Change classification of XSVG LicenseKai Koehne2020-09-071-2/+3
| | | | | | | | | | | | [ChangeLog][Third-Party Code] XSVG license was re-classified to HPND-sell-variant, "Historical Permission Notice and Disclaimer - sell variant" https://spdx.org/licenses/HPND-sell-variant.html Change-Id: Icff6d7f072f0d4b64bd1c5ce703c8c007184ad8a Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit 8b7f3b4b6e6e2f1b6721af7ca6edeb83b3b3adf8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid recursion when inflating compressed svgsEirik Aavitsland2020-08-281-10/+17
| | | | | | | | | | | | Avoid the possibility of recursion loop for corrupt compressed files, and generally simplify the code, particularly the handling of the QT_NO_COMPRESS flag. Change-Id: Ic21a4814a45c4303cc366152be65ae54fa973461 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 3d67824828cf37a2357153e1c832b4cb06d3b485) Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Implement basic format check also for compressed svgsEirik Aavitsland2020-08-271-6/+19
| | | | | | | | | | | | | | | | | For uncompressed files, QSvgIOhandler::canRead() will reject any file that does not start out with a svg or xml tag. That rudimentary check was never done for compressed files (svgz). Implement the check during the decompressing itself, so that we can fail early and not waste time and memory decompressing potentially huge files that are anyway not valid svgs. Fixes: oss-fuzz-24611 Change-Id: I154efd8adafe7f09307e8b28a66b536539b1e4bd Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 93466dad6613085a5044a862a3a84a4eba6fcef9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't return partially inflated QByteArrayRobert Loehning2020-08-261-1/+1
| | | | | | | | | | | We're already stopping the extraction because we're running out of memory. It's no use to return this provisional result. Task-number: oss-fuzz-24611 Change-Id: Iea5a65a0f30b7a03c5405017c21cd9495a7c2971 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 103aace3b30ede9e5f5621e14542f5369eac749d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix check against division by zeroRobert Loehning2020-08-191-4/+5
| | | | | | | | | | | The squared values must not be zero. Since both are qreal, this can happen even when neither of them is zero itself. Fixes: oss-fuzz-24738 Change-Id: I61b2bc891e7e3831d4b6ee68b467db28c4f877d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7f1945c5fb492505db9a43853987eaf805291919) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use qFuzzyIsNull instead of isEmpty() on QRectFRobert Loehning2020-08-061-1/+1
| | | | | | | | | | Avoids an integer overflow in QOutlineMapper Fixes: oss-fuzz-24131 Change-Id: I77a280640df4971e440d3f8888d2e7036a1f2e6a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 21ae1e161c933ffae38d42fe8191975d5ad8ee6e)
* Don't divide by zeroRobert Loehning2020-08-041-0/+2
| | | | | | | | Fixes: oss-fuzz-24308 Change-Id: I628f073cc2ec99b18333d2831c53cd888ebc5780 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 3206ab23a01ff19850ebdce6ac0338ddb29b5b95) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid endless recursion in SvgStructureNode::boundsRobert Loehning2020-07-302-2/+8
| | | | | | | | Fixes: oss-fuzz-24028 Change-Id: I2ddfcd494747f2857d56ce54bc9c4ee3f986ac3e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 3f11586d79566c9ceb311c6c4a1ea12078deed5d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Avoid endless recursion when inflating gzipRobert Loehning2020-07-291-3/+5
| | | | | | | | Fixes: oss-fuzz-24146 Change-Id: I52a974e6a0694fb4afb50d932b2e99917c3034b2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 8368111c76471a7415c29ba293848003fca2a4af) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Return nullptr instead of 0Robert Loehning2020-07-241-1/+1
| | | | | | | Change-Id: I200214f90ce399034dabc61b00d20f7def8d923d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 0e1ea7b93388eca35814d3527584461074350f0f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Don't divide by zeroVolker Hilsheimer2020-07-171-0/+3
| | | | | | | | | Fixes: oss-fuzz-23731 Change-Id: Ib21a32a30f7a204d263e6710f17567d91c6aae79 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit a7941a5b82e1b8397e9d5f20e5a68c8aac37fb51) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix stack overflow in dtor of QSvgTinyDocumentRobert Loehning2020-07-151-1/+10
| | | | | | | | | | | Add a maximum to how many unfinished elements will be parsed by QSvgHandler. Fixes: oss-fuzz-24000 Change-Id: I4cea0500d2bc503d2c509d091300dd1117170299 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 2fc2cb44b275c7c18c2db262eec443eb198b9cc6) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add error handling to color parsingAllan Sandfeld Jensen2020-06-231-19/+22
| | | | | | | | | | | Also fixes undefined shift of negative values. Fixes oss-fuzz 23644 Change-Id: I08c998ebf2217cb8dc50fcb805603e01e67ad64b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 9a0d4ff631003a84205c61bd7a6ef843207f1675) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix stack overflow in QSvgHandler::resolveGradientsAllan Sandfeld Jensen2020-06-232-5/+7
| | | | | | | | | | | Add a maximum to how deep it will nest. Fixes oss-fuzz 23643 Change-Id: I6183c04f65a539a6c7df42bc7346a86ee58aca6c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6b86b5de893e9885f8288af5a096444b30fa2628) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix oom in QSvgTinyDocument::loadAllan Sandfeld Jensen2020-06-231-0/+6
| | | | | | | | | | | | Avoid overflowing the size integer. Fixes ozz-fuzz 23606 Change-Id: Iaae2c1e78e59737bba0e34791de4a3a92677f319 Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 99a86c1bc347092d76f1288d901b30643b8eea6c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Use QRect::isEmpty instead of QRect::isNullAllan Sandfeld Jensen2020-06-221-5/+5
| | | | | | | | | | | Otherwise we can end up processing empty rects, and get divisions by zero. Fixes oss-fuzz issue 23633. Change-Id: I0415462712792cb6a00eadd510b1688e859c419c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit b5865df798323a63d8a89b8b50116888b930f3f0)
* Handle empty rectsAllan Sandfeld Jensen2020-06-221-10/+15
| | | | | | | | | | | | | Avoids a division by zero, also we don't appear to support auto sizes, so width and height are required attributes. Fixes oss-fuzz issue 23588. Change-Id: Ib3474c2ed4409977f6ffcf73088956c6c59ce4ad Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Robert Loehning <robert.loehning@qt.io> (cherry picked from commit 78cbbc1aa3a4802b2eeec8b5abfe196e05df1b16) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix stack overflow on indirect self-referralAllan Sandfeld Jensen2019-04-242-9/+15
| | | | | Change-Id: If2b13c3dc4a09ce6d18aff97855179172f92878b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix leak in SVG font nodesAllan Sandfeld Jensen2019-04-241-7/+7
| | | | | | | | Their lifetime is controlled by the document, but the logic was confused and lost the node. Change-Id: Ib074dcf209d53ade894ee571a0bc08a1a7acfcab Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge remote-tracking branch 'origin/5.12.3' into 5.12Qt Forward Merge Bot2019-04-172-2/+10
|\ | | | | | | Change-Id: I73662000d1b52a4b61a9bd0a58af2fb9a7dc7b22
| * Fix crash for recursive gradient referencesEirik Aavitsland2019-04-022-2/+10
| | | | | | | | | | | | | | | | | | A reference loop with at least three elements would lead to endless recursion. Fixes: QTBUG-74189 Change-Id: Ie3c1b32da0e98e9218dc387dd3210666018a92e1 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Fix assert on misplaced tspan elementAllan Sandfeld Jensen2019-04-121-0/+7
|/ | | | | Change-Id: I75b3a88aae3cbd7838474d7a78f29fcd58172fc2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix IRI parsing, and use after freeAllan Sandfeld Jensen2019-03-042-3/+16
| | | | | | | | | | Make the parsing of IRI references tighter, and avoid freeing styles when inserting a duplicate id. Fixes: QTBUG-74104 Change-Id: I3a12fcf09ce1c55c135a4209817413ed8af75dec Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix heap overflow in path parsingAllan Sandfeld Jensen2019-03-011-1/+1
| | | | | | Fixes: QTBUG-74129 Change-Id: I871c144f1df288a310e82aef979af7cfd7a54095 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* Don't leak nodes on parsing failuresAllan Sandfeld Jensen2019-02-272-4/+15
| | | | | | | | | | | The QSvgHandler always expects the caller to handle ownership of the generated document, also when the parsing failed. QSvgHandler also failed to handle misplaced group elements. Fixes: QTBUG-74083 Change-Id: I8907117d4305ecd84e328b201791001cb877fc60 Reviewed-by: Robert Loehning <robert.loehning@qt.io>
* Fix QSvgRenderer incorrect render of svg:imageDavid Crémoux2019-02-063-11/+11
| | | | | | | | | | The bounds of QSvgImage are integer based (QRect) which cause rounding issues when decimals values are used to define image (image shifted and with incorrect size). Changing the bounds to QRectF solves the issue. Fixes: QTBUG-73445 Change-Id: I49828e2c0b1917ec878844d520aac182581c23fb Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Allow <style> without type attributeChih-Hsuan Yen2019-01-291-1/+1
| | | | | | | | | | | | | | According to https://www.w3.org/TR/SVG/styling.html#StyleElement, `type` can be omitted. > If the attribute is not specified, then the style sheet language is assumed to be CSS. Original-Author: Christoph Feck Fixes: QTBUG-58326 Fixes: QTBUG-69378 Change-Id: Ic3d0e8db99da8c81e5a01c0dda33fb38428e38d5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Consider relative path in image tagsLars Schmertmann2018-11-302-5/+20
| | | | | | Task-number: QTBUG-16198 Change-Id: I26bf48cbac39af0fae490ed21579e8de326cd1a3 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix parsing of forward referrals in use elementsEirik Aavitsland2018-08-203-15/+55
| | | | | | | | | | SVG <use> elements may refer to a node that is defined later in the file. The parser would then fail to resolve the link. Implement delayed link resolution in the parser to handle such cases. Task-number: QTBUG-69694 Change-Id: I94ffb3511dbd0fac822bb56991415b2d99ccf90e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Migrate QSvgHandler to use QRegularExpressionSamuel Gaist2018-08-121-11/+11
| | | | | | | | This patch updates the QSvgHandler class to use QRegularExpression in place of QRegExp which is to be considered deprecated. Change-Id: Ie35ff1e697741711440b6a99da26d435bc782d15 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-311-5/+6
|\ | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: Ic41094e6744df3d84d76bcfe701092e137660f80
| * Fix crash when parsing malformed url referenceEirik Aavitsland2018-07-301-5/+6
| | | | | | | | | | | | | | The parsing did not check for end of input. Change-Id: I56a478877d242146395977b767511425d2b8ced1 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Fix transformation of gradients for svg objectBoundingBox coordinatesEirik Aavitsland2018-06-292-2/+2
| | | | | | | | | | | | | | | | | | | | | | QBrush transformations were not applied in the object coordinate space, even when using Qt's ObjectBoundingMode. Use the new ObjectMode instead to fix this. Task-number: QTBUG-59978 Task-number: QTBUG-67995 Change-Id: I79f529853ed8bca86b1811f4edf66244a026a27c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Make svg icons work as pixmap iconsThorbjørn Martsum2018-06-111-25/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes the svg icon code similar to the code for pixmap icons. We only style the code if we fetch a different mode (+it is not normal) and we try to find icons in same order as the pixmap icons. [ChangeLog][][QIcon/QSvgIconEngine] Made SVG icons behave like pixmap icons: An explicitly-set disabled icon is no longer additionally grayed out. Task-number: QTBUG-67452 Change-Id: I94b4146bae2e9d924a96b602bf23909bd7f0e934 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Morten Kristensen <msk@nullpointer.dk> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | SVG image handler: catch and warn about QImage allocation failureEirik Aavitsland2018-05-221-1/+6
|/ | | | | | | | | | | QImage allocation failure, typically because of out-of-range dimensions, was not immediately caught and reported. This could lead confusing error messages as QPainter would render on a null image. Task-number: QTBUG-68229 Change-Id: If99033244728f1cea635691c6a93564976962f09 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Interpret width or height specified in percent as relative to viewportFrederik Christiani2018-04-301-3/+6
| | | | | | | | | | | When width or height is specified in percent, it is supposed to be relative to the viewport. https://www.w3.org/TR/SVG/coords.html#Units Task-number: QTBUG-2279 Change-Id: Ia1597b88d4e1c705a6755db788a18cf790d5ee97 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix rotate animation freezing in wrong positionv5.11.0-beta4Friedemann Kleint2018-04-111-1/+1
| | | | | | | | | | | | In QSvgAnimateTransform::resolveMatrix(), the indexes into the vals array were previously calculated to be 1,1 in the final step, where currentPosition=1, by using qCeil()/qFloor(), resulting in rotationDiff=0 and the rotation snapping back. Fix by setting startElem to endElem - 1 when available. Task-number: QTBUG-67525 Change-Id: Ie1d7e8be6ea8dd9aa155ee8c479037bc269f6df7 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QSvgHandler: Change some usages of QString to QStringRefFriedemann Kleint2018-02-271-57/+54
| | | | | | | | QString allocation can be avoided in some places after the introduction of QStringRef::toInt()/toDouble(). Change-Id: Ib400f49df04847f85aeea0190215f864f71223bd Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix warning when encountering font-size="none"Friedemann Kleint2018-02-271-27/+51
| | | | | | | | | | Extend existing enum by "none" and extract a function to return the specification so that "none" can be cleanly handled. Task-number: QTBUG-66646 Change-Id: If4ec1056c6f0fa407f76b747634bb898e75a5474 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-121-1/+1
|\ | | | | | | Change-Id: Ic852de844e8a1e7acfe4aaaf79acf46674ba5ffa
| * MSVC: Don't set a DLL base address for 64-bit5.10Thiago Macieira2018-01-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The linker complains: LINK : warning LNK4281: undesirable base address 0x67000000 for x64 image; set base address above 4GB for best ASLR optimization And it's not really required anymore, as the recommended /DYNAMICBASE is the default. Change-Id: I56b444f9d6274221a3b7fffd150caab1beecfd43 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-201-1/+1
|\ \ | |/ | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I2d1692e18205aa86e7181d907eac21dc096744ae
| * svgiconengine: Fix isNull() for deserialized iconsPalo Kisa2018-01-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 4a9470e55ce08752501868c60762268fdf2c44af there was introduced specific isNull() implementation for QSvgIconEngine. But the existing check was not sufficient for the scenarios where the QIcon is constructed by deserialization from QDataStream (from previously serialized valid svg QIcon). We also need to check the svgBuffers as the previously serialized svgFiles are silently ignored by QSvgIconEngine::read(). Change-Id: Id64ce233baead053c8b5ca61f1d416e46a8c6088 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* | Port away from QRegion::rects()Marc Mutz2017-12-051-2/+1
| | | | | | | | | | | | | | Use begin()/end() instead. Change-Id: Ia51069dba42aa26e78b071b147a69c7f36947d12 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-2013-43/+78
|\ \ | |/ | | | | Change-Id: I7e158268343c5d92d666d266a87095f1154714dd
| * Merge remote-tracking branch 'origin/5.9' into 5.10v5.10.0-rc3v5.10.0-rc2v5.10.0-rc1v5.10.05.10.0Liang Qi2017-11-154-1/+18
| |\ | | | | | | | | | Change-Id: I2c5f1f592e2141b93fa274124a96f2a63b83acdb
| | * Fix crash on recursive self-referral in <use> elementEirik Aavitsland2017-11-154-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Referring to an ancestor in a <use> element would lead to endless recursion. Add checks to avoid recursion, and also emit a warning while parsing. Task-number: QTBUG-64425 Change-Id: I9ee1b9bfef13796cc3f387ff8579c6b13bc4ae9a Reviewed-by: Andy Shaw <andy.shaw@qt.io>
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-10-3011-42/+60
| |\ \ | | |/ | | | | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I8b9a5a395dbd6659f7806eeebdd665c760a71ec1
| | * Fix outdated FDL license headerv5.9.35.9.3Kai Koehne2017-10-173-15/+15
| | | | | | | | | | | | | | | Change-Id: I2a2501a61107717b8e1adacad064664cf54cd972 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
| | * Fix outdated BSD license headerKai Koehne2017-10-173-9/+39
| | | | | | | | | | | | | | | Change-Id: I3917e7ab180b49c77bff0d071eca10f8bc7f33c7 Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>