summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qicc.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Handle para tags the same way for OOB checks as the other tagsAllan Sandfeld Jensen2021-03-021-21/+16
| | | | | | | | | Do not include the first parameter in the main tag anymore. That is a left over from before unaligned access was added. Pick-to: 6.1 Change-Id: I2caf027c6b9930d3e23fe5ec8bdcd45db34835a9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Handle desc tags the same way for OOB checks as the other tagsAllan Sandfeld Jensen2021-03-011-7/+3
| | | | | | | | | | Including one entry of the value in the header is pointless after the unaligned access rewrite, and a potentially dangerous pattern, though safe here due to overchecking. Pick-to: 6.1 Change-Id: I4c0380040f89920467c309503408f1df6f88423f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix out-of-buffer in ICC curv parsingAllan Sandfeld Jensen2021-02-281-5/+6
| | | | | | | | | | After the unaligned ICC profile fix, we could read 2 bytes past the end of the buffer for curv elements with 0 parameters, though we wouldn't use or return the data. Pick-to: 6.1 6.0 5.15 Change-Id: Ibea9fa2840c01d690716d8f48e301fbfa67aa163 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Reduce warnings from ICC parsingAllan Sandfeld Jensen2021-02-251-7/+9
| | | | | | | | | | Messages about Qt deficiencies reduced to info, and info set as the default message level. Pick-to: 6.1 6.0 5.15 Fixes: QTBUG-91401 Change-Id: Ia97438f08de5e0383e77631dca9b253b47ef8167 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix logic problems with table based grayscale ICC profilesAllan Sandfeld Jensen2021-02-251-1/+1
| | | | | | | | | White-point was calculated wrongly and some tables could cause bad behavior in the tables. Pick-to: 6.1 6.0 5.15 Change-Id: I24e8f5f3cc1306f5f898a4acbf7b008e26bd04e2 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix division by zeroAllan Sandfeld Jensen2021-01-271-0/+4
| | | | | | | | | | Consider a zero we need to divide with illegal input. Fixes oss-fuzz 29347 Pick-to: 5.15 6.0 Change-Id: I2aae1d765d2dd81c95d423038ef5cb878d4f8026 Reviewed-by: Robert Löhning <robert.loehning@qt.io>
* Protect against sign-change of size on 32bitAllan Sandfeld Jensen2021-01-271-1/+1
| | | | | | | | | | | | Since qsizetype is signed and the profileSize unsigned, it can turn negative circumventing the test here. Fixes oss-fuzz issue 29278. Pick-to: 6.0 5.15 Change-Id: I1e211c78db6f4ff150613f52d8fc29807f0088ff Reviewed-by: Robert Löhning <robert.loehning@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QColorSpace: port to QESDPGiuseppe D'Angelo2020-10-181-1/+2
| | | | | | | | | | Replace the hand-rolled refcount management with QESDP. Since the class has a default-constructed / moved-from state where the d-pointer can be nullptr, add a in-class detach() that ensures a private object. Change-Id: Id81431fa60132dbc0eed45bb60b38d4f7d73833f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Do not assert on invalid ICC curv tableAllan Sandfeld Jensen2020-10-011-1/+4
| | | | | | | | Reject invalid table data, do not assert it. Pick-to: 5.15 Change-Id: I1fdda4c735bb97bb93ac8f8654ac4cc5fada5389 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* QIcc: fix alignment concerns in ICC profile parsingAndrei Golubev2020-09-151-83/+103
| | | | | | | | | | | Updated QIcc::fromIccProfile() and friends to not rely on QByteArray pointer alignment. Used qFromUnaligned() instead Task-number: QTBUG-84267 Pick-to: 5.15 Change-Id: I69ef7e011707bec27cd84693e7f0e92d79a577d1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Use QList instead of QVector in gui implementationJarek Kobus2020-07-071-1/+1
| | | | | | | Task-number: QTBUG-84469 Change-Id: I366e845249203d80d640355a7780ac2f91a762f1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Fix deprecation warning, use char16_t instead of quint16/ushortVolker Hilsheimer2020-06-081-2/+2
| | | | | | Change-Id: I4021abb901260c3e27cefd81b3acd5ac198941c8 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Add error message on unaligned profile inputsAllan Sandfeld Jensen2020-05-191-0/+5
| | | | | | | Pick-to: 5.15 Task-number: QTBUG-84267 Change-Id: I7ec2100455bd0178cdff0de2d24abbe6c19f812f Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLiang Qi2020-05-181-1/+2
|\ | | | | | | | | | | | | Conflicts: src/corelib/text/qbytearray.cpp Change-Id: I63706409464d31391012bacdadfd1f6300509787
| * Fix 32bit integer overflow in ICC parsingv5.15.0-rc1Allan Sandfeld Jensen2020-05-041-1/+2
| | | | | | | | | | | | Change-Id: I98c413374374a6143733860aa9bab1a957cd3b2d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Change qHash() to work with size_t instead of uintLars Knoll2020-04-091-1/+1
|/ | | | | | | | | | | This is required, so that QHash and QSet can hold more than 2^32 items on 64 bit platforms. The actual hashing functions for strings are still 32bit, this will be changed in a follow-up commit. Change-Id: I4372125252486075ff3a0b45ecfa818359fe103b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Parse grayscale ICC profilesAllan Sandfeld Jensen2020-02-171-35/+81
| | | | | | | | | Parse them into color profiles, they are a simple subset with just a single TRC and a whitepoint. Change-Id: I300537d488feb3e907a1acff928b2519ffa75088 Fixes: QTBUG-81830 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove BT.2020 support from QColorSpaceAllan Sandfeld Jensen2019-09-081-3/+0
| | | | | | | | | | | | BT.2020 is an HDR color space and its luminance range doesn't match that of the rest of the currently available color spaces. Without support for white-point luminance in 5.14, there would be a behavior change when luminance support is later introduced, so it is better to remove it now, and reintroduce it when the necessary handling of different luminance levels is available. Change-Id: Ie29e4dd757faae3ac91d4252e1206acce42801dc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Simplify QColorSpace named presetsTor Arne Vestbø2019-09-031-4/+3
| | | | | | | | | | | | | | We don't need a getter for the 'preset' of a color-space, as color spaces can be compared to the presets directly. This allows us to remove the Undefined and Unknown values from the presets. Internally we still distinguish known presets from unknown or undefined presets via the magic 0-value. The validity of a QColorSpace is not based on this preset, but on its actual values. Fixes: QTBUG-77963 Change-Id: I1e0a2a4be83021b8c82b3c778019f680fd46455b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Improve our color space terminologyAllan Sandfeld Jensen2019-08-021-12/+12
| | | | | | | | | | | | | | | Replace our use of 'gamut' with 'primaries'. One is the axes of the color space, the other the volume of representable values. For the currently supported color spaces those are mostly equivalent, but when we later add support for scRgb, this would be misleading as it has the same primaries as sRGB but a much wider gamut, and we would like to use the same primaries/"gamut" id for it. Also few people would know what "the sRGB gamut" is, but "the sRGB primaries" is easily googable. Change-Id: I3348ccaae27a071ec77a4356331b9bbbf92e0d19 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Parse color space name from ICC profileAllan Sandfeld Jensen2019-07-311-2/+75
| | | | | | | Adds parsing of ICCv2 and ICCv4 description tags. Change-Id: I8647e1529d4127950624f16c475d8dba610149b6 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Harden ICC parserAllan Sandfeld Jensen2019-07-311-52/+90
| | | | | | | | | | | Add missing implicit size checks of tags by passing the already checked explicitly given size forward. Also adds my fuzzing test for the ICC parser as it is security critical, by being used by multiple image formats. Change-Id: Ieb632ccb78f9b445a276959ffbd66fa04a7a5b45 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Remove public d_func from QColorSpaceAllan Sandfeld Jensen2019-07-231-2/+2
| | | | | | | Replaced with getter in private. Change-Id: I968eb45052a80b45750213cf6a0c08b5973dfc4d Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Long live QColorSpace and friendsAllan Sandfeld Jensen2019-02-081-0/+669
Adds QColorSpace and QColorTransform classes, and parsing of a common subset of ICC profiles found in images, and also parses the ICC profiles in PNG and JPEGs. For backwards compatibility no automatic color handling is done by this patch. [ChangeLog][QtGui] A QColorSpace class has been added, and color spaces are now parsed from PNG and JPEG images. No automatic color space conversion is done however, and applications must request it. Change-Id: Ic09935f84640a716467fa3a9ed1e73c02daf3675 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>