Kaydet (Commit) b0a421d6 authored tarafından Stephan Bergmann's avatar Stephan Bergmann Kaydeden (comit) Miklos Vajna

Set maLayoutSize also for non-RES_FLYFRMFMT, like RES_DRAWFRMFMT

Running CppunitTest_sw_ww8export2's testTdf111480 under Clang's
-fsanitize=implicit-signed-integer-truncation fails in
SwWW8WrGrf::WritePICFHeader (sw/source/filter/ww8/wrtww8gr.cxx) when the passed-
in nHeight, where both nWidth and nHeight are zero, is reduced to below zero
when subtracting nThick for the borders.  In turn, nWidth and nHeight being zero
is caused by SwWW8WrGrf::Insert (sw/source/filter/ww8/wrtww8gr.cxx) calling
rFly.GetLayoutSize(), and that ww8::Frame::maLayoutSize being left initialized
to zero in the

  Frame::Frame(const SwFrameFormat &rFormat, const SwPosition &rPos)

ctor (sw/source/filter/ww8/writerhelper.cxx) unless it is a RES_FLYFRMFMT (while
in this scenario it is a RES_DRAWFRMFMT).

The additional maLayoutSize, and SwWW8WrGrf::Insert calling GetLayoutSize()
instead of GetSize(), were added with CWS ww8export01_SRC680 commits in 2007
(e.g., a79a54b2 "INTEGRATION: CWS
ww8export01_SRC680"), to fix <https://bz.apache.org/ooo/show_bug.cgi?id=43447>
"export to .doc of images with captions if image had been resized".  It looks
like those commits didn't take into account that GetLayoutSize() could also be
called for non-RES_FLYFRMFMT while it would erroneously be left initialized to
zero for those.

Change-Id: I7455ab43268d132dc23958185a48a1e73214c7ca
Reviewed-on: https://gerrit.libreoffice.org/68151
Tested-by: Jenkins
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.com>
üst 1f0206d9
......@@ -241,6 +241,7 @@ namespace ww8
else
meWriterType = eDrawing;
maSize = pObj->GetSnapRect().GetSize();
maLayoutSize = maSize;
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment