summaryrefslogtreecommitdiff
path: root/vcl/inc/graphic
AgeCommit message (Collapse)Author
2024-06-27vcl: Remove graph. reader context from {Imp}Graph and GraphicReaderTomaž Vajngerl
This removes the mpContext member variable from ImpGraph, which also make {Get,Set}ReaderContext on Graphic obsolete and is also removed. GraphicFilter and other code is adjusted and simplified. Change-Id: Icd1927d7b1bd4624b523d0f49a4343911ec6cd0a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165214 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-06-20loplugin:unusedmethodsNoel Grandin
Change-Id: Ia216da9bd7764f2d21aaee761a02eafda88d892e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169257 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
2024-05-12replace createFromAscii with OUString literals in getImportFormatShortNameNoel Grandin
Change-Id: I3f62ea563af8e2c9aa5ed558370b49f05804c632 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167550 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-30vcl: change (graphic) Manager into a general memory managerTomaž Vajngerl
Graphic memory manager was changes so that it can work with any object that implements a specific interface (MemoryManaged). With this it will be possible to use other objects (that take a lot of memory) to be managed by the manager. It is also a first step to move memory managin responsibilities away from Graphic and move it into the specific objects instead (BitmapEx, Animation and VectorGraphic). Change-Id: I7638bd89a1c9ece5c4bc95b506d2192492894ef3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164958 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2024-03-14reduce symbol visibility in vclNoel Grandin
Change-Id: Ifaa37246e79678aa0c548b9ca8a9faf8036b9195 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164804 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-05tdf#143148 Use pragma once in vcl/inc/graphicTuukka Orava
Change-Id: Id88d0c64f02d9a0ca111de3d08e3d542dfba2a1c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162997 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
2023-10-23Extended loplugin:ostr: Rewrite some O[U]StringLiteral -> O[U]StringStephan Bergmann
...in include files. This is a mix of automatic rewriting in include files and manual fixups (mostly addressing loplugin:redundantfcast) in source files that include those. Change-Id: I1f3cc1e67b9cabd2e9d61a4d9e9a01e587ea35cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158337 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-08-23tdf#146619 Remove unused includes from vcl/incGabor Kelemen
Change-Id: I8fbe02547d5045cfdb5021720b10ddd10106209a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155750 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2023-06-10tdf#104877 Add basic APNG format supportParis Oplopoios
Add basic APNG (animated PNG) format support that can correctly display simple files with no transparency Change-Id: Ibfb6e13953a8ba48a535a40b08792b3723b7dc0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140089 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-03-30Report correct mimetypes for TIF and EMFMike Kaganski
Change-Id: I2eeb07780e3581eea29a9ad98b493de4e78a5d65 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149745 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2023-03-11lok: add trimMemory capability, and expand dumpState to caches.Michael Meeks
Being able to trigger some more aggressive memory saving is useful in for both online and mobile. Change-Id: I9b91c9fe9eecec06c75112595deac0bfeb94c144 Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148624 Tested-by: Jenkins
2023-01-23XUnoTunnel->dynamic_cast in vcl::GraphicNoel Grandin
Change-Id: Iecbae3570851784f0da75fd2899daf620c8e4c06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145994 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2023-01-20Base GraphicDescriptor on OWeakObjectStephan Bergmann
...rather than on the legacy OWeakAggObject. It was found that e.g. Graphic, deriving from GraphicDescriptor, was implementing queryInterface in a way that is incompatible with XAggregation protocol inherited via OWeakAggObject. It looks like no code actually made use of the XAggregation offered by this class hierarchy, so the easiest fix for that queryInterface implementation appears to switch from OWeakAggObject to OWeakObject. Change-Id: I54514db32b731b9fa83831a1071da6f665fdf25e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145891 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2023-01-15XUnoTunnel->dynamic_cast in UnoBinaryDataContainerNoel Grandin
Change-Id: Ifdef69448558f4c5d6902188208d3eea1a080334 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145506 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-09-14Remove code duplication in GraphicDescriptor for PBM/PGM/PPMofftkp
GraphicFormatDetector and GraphicDescriptor have duplicate format detection code so now GraphicDescriptor uses GraphicFormatDetector functions instead to detect the format for PBM/PGM/PPM files Change-Id: Ib239bb0aafcfa691d63025d5965f199bf11c7649 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138847 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2022-08-19Remove code duplication in GraphicDescriptor for WMF/EMFofftkp
GraphicFormatDetector and GraphicDescriptor have duplicate format detection code so now GraphicDescriptor uses GraphicFormatDetector functions instead to detect the format for WMF/EMF files and their Z compressed counterparts WMZ/EMZ Change-Id: Ia054c782320923aaa0c2c8bda2f33c27c3b123d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138067 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-08-12cid#1507888 Uninitialized scalar fieldCaolán McNamara
Change-Id: I64747e43f76d0f214efc4bd964795517561d9693 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138163 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2022-08-10Remove code duplication in GraphicDescriptor for GIFofftkp
GraphicFormatDetector and GraphicDescriptor have duplicate format detection code so now GraphicDescriptor uses GraphicFormatDetector functions instead to detect the format for GIF files Change-Id: Ieabacb302c9c712fc6f3da85eaccc07dca035eba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137934 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-08-10Prepare GraphicDescriptor and GraphicFormatDetector for mergingofftkp
Make GraphicFormatDetector return GraphicFileFormat instead of a string and various variable changes so that the two can be combined in future patches. Change-Id: I6e184b3ba52289db02e0d4eebeeadde0ce0433b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137627 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-07-13clang-tidy modernize-pass-by-value in vclNoel Grandin
Change-Id: I9ddb786eb88213c53cf53067ced6899ca40ac6e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137000 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-05-06tdf#103954: Z compressed graphic formats support for EMF/WMFofftkp
- Added .emz and .wmz file opening support - Added a function to check for Z compression that all z comp. formats can use - Added 3 unit tests for emf/emz/wmz files and the example files have been checked with a different tool (File Viewer 4) - emf/emz file detection changed from magic byte checking to extension checking, like wmf/wmz does Change-Id: I3e433fd23d18482648a51cd04b8f467368e97b62 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132456 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2022-01-31support for the WebP image format (tdf#114532)Luboš Luňák
This commit implements a WebP reader and writer for both lossless and lossy WebP, export dialog options for selecting lossless/lossy and quality for lossy, and various internal support for the format. Since writing WebP to e.g. ODT documents would make those images unreadable by previous versions with no WebP support, support for that is explicitly disabled in GraphicFilter, to be enabled somewhen later. Change-Id: I9b10f6da6faa78a0bb74415a92e9f163c14685f7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128920 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-11-19loplugin:stringliteraldefine in vclNoel Grandin
Change-Id: Id14cc8613fdfb67790efd6c33ee243f6bdb522f3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125546 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-22fix deadlock in vcl::GraphicManagerNoel Grandin
after commit 300753bf1d4db7eff42d707f427180f0d1d1dffb no need to use recursive_mutex in graphic::Manager Change-Id: I85b6f83d513ea1998e1bd7c3be5cea999c590c5b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122426 Tested-by: Jenkins Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-21no need to use recursive_mutex in graphic::ManagerNoel Grandin
regular std::mutex is fine Change-Id: I820bb83117a0ea920f550f6ad459a623b4939ee3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122390 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-07-13merge UnoGraphicTransformer into UnoGraphicNoel Grandin
it is never instantiated by itself. And this also means it now only has one OWeakObject base class Change-Id: I3074130539ab023fec5537e0e7794e1c2db7e6ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118835 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-05-02throw() -> noexcept, part 2/3: Automatic loplugin:noexcept rewriteStephan Bergmann
Change-Id: I076f16d0536b534abf0ced4d76051eadb4c0e033 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114949 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2021-03-20crashtesting: crash on reexport of tdf118346-1.odg to odgCaolán McNamara
#10 0x00007fffef6f9e1c in vcl::graphic::Manager::reduceGraphicMemory() (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager>) at vcl/source/graphic/Manager.cxx:120 #11 0x00007fffef6fa0c4 in vcl::graphic::Manager::registerGraphic(std::shared_ptr<ImpGraphic> const&) (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager> std::shared_ptr<ImpGraphic> (use count 1, weak count 0) = {...}) at vcl/source/graphic/Manager.cxx:159 #12 0x00007fffef6fa749 in vcl::graphic::Manager::newInstance() (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager>) at vcl/source/graphic/Manager.cxx:202 #13 0x00007fffef4aba15 in Graphic::Graphic() (this=0x7ffffff32f18) at vcl/source/gdi/graph.cxx:163 #14 0x00007fff9409761c in svgio::svgreader::SvgImageNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2b4e46b0, rTarget=...) at svgio/source/svgreader/svgimagenode.cxx:220 #15 0x00007fff940a2651 in svgio::svgreader::SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2ab0f6d0, rTarget=..., bReferenced=false) at svgio/source/svgreader/svgnode.cxx:529 #16 0x00007fff94092a0b in svgio::svgreader::SvgGNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2ab0f6d0, rTarget=..., bReferenced=false) at svgio/source/svgreader/svggnode.cxx:107 #17 0x00007fff940a2651 in svgio::svgreader::SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2ab0f370, rTarget=..., bReferenced=false) at svgio/source/svgreader/svgnode.cxx:529 #18 0x00007fff94092a0b in svgio::svgreader::SvgGNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2ab0f370, rTarget=..., bReferenced=false) at svgio/source/svgreader/svggnode.cxx:107 #19 0x00007fff940a2651 in svgio::svgreader::SvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2704ee70, rTarget=..., bReferenced=false) at svgio/source/svgreader/svgnode.cxx:529 #20 0x00007fff940cc179 in svgio::svgreader::SvgSvgNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer&, bool) const (this=0x2704ee70, rTarget=..., bReferenced=false) at svgio/source/svgreader/svgsvgnode.cxx:304 #21 0x00007fff940fa8cf in svgio::svgreader::(anonymous namespace)::XSvgParser::getDecomposition(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) (this=0x26ee6560, xSVGStream=uno::Reference to (comphelper::SequenceInputStream *) 0x2b4190e8, aAbsolutePath="") at svgio/source/svguno/xsvgparser.cxx:136 #22 0x00007fff940fb0a5 in non-virtual thunk to svgio::svgreader::(anonymous namespace)::XSvgParser::getDecomposition(com::sun::star::uno::Reference<com::sun::star::io::XInputStream> const&, rtl::OUString const&) () at svgio/source/svguno/xsvgparser.cxx:188 #23 0x00007fffef6af2f3 in VectorGraphicData::ensureSequenceAndRange() (this=0x70f6a70) at vcl/source/gdi/vectorgraphicdata.cxx:209 #24 0x00007fffef6b01bc in VectorGraphicData::getRange() const (this=0x70f6a70) at vcl/source/gdi/vectorgraphicdata.cxx:355 #25 0x00007fffef4bd4f0 in ImpGraphic::getPrefSize() const (this=0x5c29e90) at vcl/source/gdi/impgraph.cxx:793 #26 0x00007fffef4bd049 in ImpGraphic::createSwapInfo() (this=0x5c29e90) at vcl/source/gdi/impgraph.cxx:360 #27 0x00007fffef4c1960 in ImpGraphic::swapOut() (this=0x5c29e90) at vcl/source/gdi/impgraph.cxx:1304 #28 0x00007fffef6f9ca8 in vcl::graphic::Manager::loopGraphicsAndSwapOut() (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager>) at vcl/source/graphic/Manager.cxx:104 #29 0x00007fffef6f9e1c in vcl::graphic::Manager::reduceGraphicMemory() (this=0x7ffff09c5508 <vcl::graphic::Manager::get()::gStaticManager>) at vcl/source/graphic/Manager.cxx:120 Change-Id: If76281620dd7026196543ff3f62f29105b1e2f38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112772 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-02-23loplugin:unusedmethodsNoel
Change-Id: Ie0534244cc7a30ad006e65baf125c59757c90d50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111388 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-19loplugin:refcounting in vclNoel
Change-Id: Ieca3dd33a7ae40c3f7b8ba30f763d71a548cd144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111171 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-18vcl: move def. of peekGraphicFormat into GraphicFormatDetectorTomaž Vajngerl
Change-Id: I3b89009324f21b54ccf00f16eb47f9967a6b4e1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111091 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-02-18vcl: condense the description and rename the peek format functionTomaž Vajngerl
remove "Imp" from ImpPeekGraphicFormat function name and condense the description of the function. Change-Id: Ie7cc42645318c0035f082ae68087ca3c7077d365 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111090 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-02-01vcl: swap-in load all vector formats without intermediate GraphicTomaž Vajngerl
Previously only PDF were loaded without the intermediate Graphic objects. With this change all vector graphic formats are loaded directly to a new VectorGraphicData instance, without the need to create a intermediate Graphic object. Change-Id: Idfa7c0ae433c4bf9500110dff82b6d1ec3f3caa4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109931 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-01-22vcl: support creating a Graphic with only GfxLink as swapped-outTomaž Vajngerl
This adds support to create a Graphic with only a GfxLink and the Graphic is in a swapped-out state. This is similar to the prepared state, but the prepared state is a special state of the Graphic. In the future, all loading will probably be done in this way and prepared state will go away, but for now this is only supported for PDF and is used in PDFium import only. The main reason is to avoid that a multi-page PDF is immediately swapped out after loading, which just does unneeded work and freezes the application for a while. Change-Id: I409741d27a4ad309264cdf27b2ba03f2cf37ead9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109600 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-01-22vcl: create PDF from DataContainer, use that when swapping inTomaž Vajngerl
VectorGraphicLoader is a set of functions that "load" a vector graphic (starting with PDF) from a BinaryDataContainer. Usually this only needs to create VectorGraphicData and set the correct type, as loading will be done on-demand. Use the VectorGraphicLoader function when swapping-in so this is an alternative to calling LoadNative on GfxLink, which loads into a new Graphic via. GraphicFilter, which is something we really want to avoid. Change-Id: If529c8ddca2b31660da4ea28d8e75bb20bf3c778 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109598 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-01-20vcl: add an UNO interface and impl. for BinaryDataContainerTomaž Vajngerl
Change-Id: Icbc384892bee8c31eb7f3a39ff9a64f1199b23b1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109596 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-01-20vcl: Improve graphic manager swapping allocationTomaž Vajngerl
This improves the counting of the used space by graphics and makes the manager loop faster. Change-Id: Ifebe5fe52722d0f22dae0d1bdef02f65afb036ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109595 Tested-by: Tomaž Vajngerl <quikee@gmail.com> Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-01-15cid#1470701 Uncaught exceptionCaolán McNamara
Change-Id: Iaeaf95681c800192fcf55c77885c2f411c7ec609 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109324 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2020-11-18Remove unused Manager::registerGraphic rsContext parameterStephan Bergmann
unused ever since the code was introduced in a2b53fece14f745853bcfe1a300c3dceb580e148 "vcl: Add a internal (memory) manager for Graphic objects" Change-Id: I0e16983e7f34cded77435ae12d8adf0c3eee5f11 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106048 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-11-17loplugin:stringviewparam check methods tooNoel
not just functions Change-Id: Icca295dd159002b428b73f2c95d40725434f04d9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105789 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-08-15remove constructor with plain Bitmap from Graphic, use BitmapExTomaž Vajngerl
Change-Id: Ie429a10a8f54c6779d437ee4bc75a5ea0c427848 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100727 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-07-19compact namespace: vclNoel Grandin
Change-Id: Ic861003f522e76431fffaadc408d0a153b12d0e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99003 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-10use compact namespace syntaxNoel Grandin
mostly done using git grep -wl namespace | xargs -P 8 perl -i -pe 's/namespace\s*([\w:]+)\s*\{\s*namespace\s*/namespace \1::/g' Change-Id: Ic53dbaf443cf81fb8940155f2582a7128d829e6d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93406 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-05-04Remove what looks like debug printfStephan Bergmann
...left over presumably accidentally by bb459008de9d410e6e7ea982ce30aa22f70ae849 "vcl: add DetectorTools + tests, refactor array string matching", but which causes heap-buffer-overflow during CppunitTest_vcl_filters_test when printing an apparently not null-terminated string, see <https://ci.libreoffice.org/job/lo_ubsan/1614/>: > ==12896==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d0000e5480 at pc 0x000000454f7f bp 0x7fffaff10200 sp 0x7fffaff0f9b0 > READ of size 2049 at 0x61d0000e5480 thread T0 > #0 0x454f7e in printf_common(void*, char const*, __va_list_tag*) /home/tdf/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors_format.inc:547 > #1 0x45568b in vprintf /home/tdf/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1631 > #2 0x45575e in printf /home/tdf/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1689 > #3 0x2b0e63a119ca in vcl::checkArrayForMatchingStrings(char const*, int, std::__debug::vector<rtl::OString, std::allocator<rtl::OString> > const&) /vcl/inc/graphic/DetectorTools.hxx:57:9 > #4 0x2b0e63a1ad0a in vcl::GraphicFormatDetector::checkXBM() /vcl/source/filter/GraphicFormatDetector.cxx:426:9 [...] > 0x61d0000e5480 is located 0 bytes to the right of 2048-byte region [0x61d0000e4c80,0x61d0000e5480) > allocated by thread T0 here: > #0 0x4f5648 in operator new[](unsigned long) /home/tdf/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_new_delete.cc:108 > #1 0x2b0e63a1a839 in vcl::GraphicFormatDetector::checkXBM() /vcl/source/filter/GraphicFormatDetector.cxx:419:42 > #2 0x2b0e639685b8 in ImpPeekGraphicFormat(SvStream&, rtl::OUString&, bool) /vcl/source/filter/graphicfilter.cxx:394:23 > #3 0x2b0e639693b0 in GraphicFilter::ImpTestOrFindFormat(rtl::OUString const&, SvStream&, unsigned short&) /vcl/source/filter/graphicfilter.cxx:455:13 > #4 0x2b0e63970153 in GraphicFilter::ImportGraphic(Graphic&, rtl::OUString const&, SvStream&, unsigned short, unsigned short*, GraphicFilterImportFlags, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const*, WmfExternal const*) /vcl/source/filter/graphicfilter.cxx:1437:19 Change-Id: I8d88a417083c14e4f1a9a78f9e1354390283d83c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93403 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2020-05-03vcl: add DetectorTools + tests, refactor array string matchingTomaž Vajngerl
Add DetectorTools with byte array searching and matching to a input string (or another byte array). This refactors the existing function in GraphicFormatDetector. It needs to go into its own header so that the function(s) can be tested easily. Replace the previous searchEntry implementation with refactored one in the source code. Change-Id: I59d30b694e13f28d6366f1a99fe2ef2ea3c1a07d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93339 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-04-12replace and remove VectorGraphicDataPtr typedef for the real typeTomaž Vajngerl
There is no need to hide std::shared_ptr<VectorGraphicData> type under an alias name. It doesn't make the code more understandble and it usually is the exact opposite because we know with what type we are dealing with. Change-Id: Iec80ee99697ff2fe3a8275fc2787b5370510ebe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92069 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-03-04graphic: remove preview when importing with GraphicFilterTomaž Vajngerl
The property "PreviewSizeHint" and the enum value ForPreview in GraphicFilterImportFlags doesn't seem to be used from outside, so let's remove it as it simplifies the PNG and JPEG import filters. It is generally more recommended to load the bitmap file fully and only then resize it to a smaller (preview) size. Change-Id: I97f333686c25f7a7a4bdf6c6f0885154b515fd3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89932 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-02-25vcl: move GraphicID out of impgraph.{cxx,hxx}Tomaž Vajngerl
Change-Id: I0b3b17736a76be290f6e5b77ee547b7e650d4489 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89449 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-02-11move GraphicReader class out of graph.hxxTomaž Vajngerl
Change-Id: Id78995bfb8e8308a388ed542690ad85e4d19ce12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88425 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-02-01std::unordered_set<T*> -> o3tl::sorted_vectorNoel Grandin
which is much better for CPU cache, since the representation is more compact, and since we almost always do insert() in pointer order, there is surprisingly little sorting Also add a count() method for compatibility with std::set and the proposed std::flat_set Change-Id: I2a3211dc59919cfec5cac1497530a4c3600d50ca Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87793 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>