summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2019-02-21 14:15:38 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-02-21 15:45:24 +0100
commitb0a421d64590f962b4700ea24dee83a9f6c24715 (patch)
tree1ec92964bdd142272bc093e40550f754d611c600 /sw
parent1f0206d940cd8f7fb627a59cfe4165c0bfebaf46 (diff)
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., a79a54b255481f31db2c530278c2deee97625769 "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: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/filter/ww8/writerhelper.cxx1
1 files changed, 1 insertions, 0 deletions
diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx
index d396a04ad632..4bb3a1e370d5 100644
--- a/sw/source/filter/ww8/writerhelper.cxx
+++ b/sw/source/filter/ww8/writerhelper.cxx
@@ -241,6 +241,7 @@ namespace ww8
else
meWriterType = eDrawing;
maSize = pObj->GetSnapRect().GetSize();
+ maLayoutSize = maSize;
}
else
{