Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index


Hi,

The rtfexport subsequent test was failing with a segfault for me.
I used EXPORT DEBUGCPPUNIT=TRUE

and got the following stack trace:

Program received signal SIGSEGV, Segmentation fault.
0x478bb2d7 in RtfAttributeOutput::WriteHex(unsigned char const*, unsigned
long, SvStream*, unsigned long) () from /home/jlcastle/LibOdev/libo/solver/
unxlngi6.pro/lib/libmswordlo.so
#0  0x478bb2d7 in RtfAttributeOutput::WriteHex(unsigned char const*,
unsigned long, SvStream*, unsigned long) () from
/home/jlcastle/LibOdev/libo/solver/unxlngi6.pro/lib/libmswordlo.so
#1  0x478bb7ee in ExportPICT(SwFlyFrmFmt const*, Size const&, Size const&,
Size const&, SwCropGrf const&, char const*, unsigned char const*, unsigned
long, RtfExport const&, SvStream*) () from
/home/jlcastle/LibOdev/libo/solver/unxlngi6.pro/lib/libmswordlo.so
#2  0x478bc01b in RtfAttributeOutput::FlyFrameOLEReplacement(SwFlyFrmFmt
const*, SwOLENode&, Size const&) () from /home/jlcastle/LibOdev/libo/solver/
unxlngi6.pro/lib/libmswordlo.so
#3  0x478bc2d9 in RtfAttributeOutput::FlyFrameOLEMath(SwFlyFrmFmt const*,
SwOLENode&, Size const&) () from /home/jlcastle/LibOdev/libo/solver/
unxlngi6.pro/lib/libmswordlo.so
#4  0x478bc3f9 in RtfAttributeOutput::FlyFrameOLE(SwFlyFrmFmt const*,
SwOLENode&, Size const&) () from /home/jlcastle/LibOdev/libo/solver/
unxlngi6.pro/lib/libmswordlo.so
#5  0x478c0fa8 in RtfAttributeOutput::OutputFlyFrame_Impl(sw::Frame const&,
Point const&) () from /home/jlcastle/LibOdev/libo/solver/
unxlngi6.pro/lib/libmswordlo.so
#6  0x4790bd0c in AttributeOutputBase::TextFlyContent(SwFmtFlyCnt const&)
() from /home/jlcastle/LibOdev/libo/solver/unxlngi6.pro/lib/libmswordlo.so
#7  0x479105d7 in AttributeOutputBase::OutputItem(SfxPoolItem const&) ()
from /home/jlcastle/LibOdev/libo/solver/unxlngi6.pro/lib/libmswordlo.so
#8  0x479117a9 in MSWordExportBase::ExportPoolItemsToCHP(std::map<unsigned
short, SfxPoolItem const*, sw::util::ItemSort,
std::allocator<std::pair<unsigned short const, SfxPoolItem const*> > >&,
unsigned short) () from /home/jlcastle/LibOdev/libo/solver/
unxlngi6.pro/lib/libmswordlo.so
#9  0x478e7c7e in SwWW8AttrIter::OutAttr(unsigned short, bool) () from
/home/jlcastle/LibOdev/libo/solver/unxlngi6.pro/lib/libmswordlo.so
#10 0x478e9d03 in MSWordExportBase::OutputTextNode(SwTxtNode const&) ()
from /home/jlcastle/LibOdev/libo/solver/unxlngi6.pro/lib/libmswordlo.so
#11 0x478c5c6e in RtfExport::OutputTextNode(SwTxtNode const&) () from
/home/jlcastle/LibOdev/libo/solver/unxlngi6.pro/lib/libmswordlo.so

I poked around looking at buffers and sizes and made this correction before
a call that matches #1:

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 36d1cea..9a65c42 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3347,7 +3347,7 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const
SwFlyFrmFmt* pFlyFrmFmt, S

<< edited and inserted more code here for full context...

    const sal_uInt8* pGraphicAry = 0;
    SvMemoryStream aStream;
    if (GraphicConverter::Export(aStream, *pGraphic, CVT_PNG) !=
ERRCODE_NONE)
        OSL_FAIL("failed to export the graphic");
    aStream.Seek(STREAM_SEEK_TO_END);
    sal_uInt32 nSize = aStream.Tell();

    pGraphicAry = (sal_uInt8*)aStream.GetData();

    m_aRunText->append(ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped,
rCr, pBLIPType, pGraphicAry, nSize, m_rExport ));
    m_aRunText->append("}"); // shppict
    m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT);
    pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE;
    SvMemoryStream aWmfStream;
    if (GraphicConverter::Export(aWmfStream, *pGraphic, CVT_WMF) !=
ERRCODE_NONE)
        OSL_FAIL("failed to export the graphic");
    aWmfStream.Seek(STREAM_SEEK_TO_END);
    nSize = aWmfStream.Tell();

-    pGraphicAry = (sal_uInt8*)aStream.GetData();
+    pGraphicAry = (sal_uInt8*)aWmfStream.GetData();

    m_aRunText->append(ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped,
rCr, pBLIPType, pGraphicAry, nSize, m_rExport ));
    m_aRunText->append("}"); // nonshppict
}

Basically, fix a typo.  rtfexport test now passes instead of crashes.

I got myself sideways with gerrit or I would have submitted this there.
Submitting patch here so that no one else has to be stuck with the broken
subsequent test.

One question I have is:
Should I open a new bug for the rtfexport subsequent test failure?
I will certainly open one if it comes back for me, but should I open one
for this patch?

Plugging back in,
LeMoyne

Attachment: 0001-Fix-for-rtfexport-subsequenttest.patch
Description: Binary data


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.