tdf#73523 support WinBMPv3-NT version of BMP files (found in Visio files)
commite16a9fda5ab95f1abc0d3d6ca0437081384aa36b
authorAndras Timar <andras.timar@collabora.com>
Mon, 3 Jan 2022 21:12:01 +0000 (3 22:12 +0100)
committerXisco Fauli <xiscofauli@libreoffice.org>
Mon, 10 Jan 2022 18:26:41 +0000 (10 19:26 +0100)
tree997f4c657a66941328717d7f516c4c247215f89d
parent0c54ddf5237914560a121453b41c8e3a50f02019
tdf#73523 support WinBMPv3-NT version of BMP files (found in Visio files)

It is a special case when there are additional 12 bytes of color bitfields
after the info header. See also the useful comments at
https://searchfox.org/mozilla-central/source/image/decoders/nsBMPDecoder.cpp#47

It turned out we generate this type of BMP files internally from EMF files,
but in that case the bfOffBits of BITMAPFILEHEADER struct points to the
pixel data. In case of Visio, bfOffBits points to the color mask. There was
no better solution than preventing jumping back in the stream.

Change-Id: I97f0fd4f184ea77beeab8b22fc98fdb78472d9bb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127920
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127927
Tested-by: Jenkins
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 3a0d539b3a8a76efc2cdac04c658645fe750bec4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128158
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
vcl/qa/cppunit/BmpFilterTest.cxx
vcl/qa/cppunit/data/tdf73523.bmp [new file with mode: 0644]
vcl/qa/cppunit/graphicfilter/data/bmp/pass/crash-1.bmp [moved from vcl/qa/cppunit/graphicfilter/data/bmp/fail/crash-1.bmp with 100% similarity]
vcl/source/bitmap/dibtools.cxx