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: Miklos Vajna <vmiklos@collabora.com>
Showing
Please
register
or
sign in
to comment