Menu

#6 Invalid downcasts to libmwaw_applepict2::OpCode

current
closed
None
2015-01-12
2014-08-29
No

libmwaw_applepict2::PictParser::PictParser (src/lib/MWAWPictMac.cxx) downcasts libmwaw_applepict1::OpCode members of libmwaw_applepict1::s_listCodes to libmwaw_applepict2::OpCode, which gets flagged by -fsanitze=undefined.

A minimal workaround is to remove the unnecessary-anyway virtual destructor of libmwaw_applepict1::OpCode, which prevents -fsanitize=undefined from detecting the problem. See attached minimal.patch.

An additional fix is to reduce the libmwaw_applepict2::OpCode derivation to a non-member function libmwaw_applepict2::readData2 (which requires changing the static member function libmwaw_applepict1::OpCode::readValue from protected to public), removing the need for any invalid downcasts. See attached additional.patch.

2 Attachments

Discussion

  • Anonymous

    Anonymous - 2014-08-29

    Hello,
    I will do a commit this week-end to fix this problem which will probably remove the libmwaw_applepict2::OpCode class and check if we need realignment in libmwaw_applepict2 ::PictParser::parse after calling readData...

    Note: actually nothing creates a libmwaw_applepict2::PictParser, I only reactive it when I find a spurious pict that I want to analyze...

    osnola

     

    Last edit: alonso laurent 2014-08-29
  • alonso laurent

    alonso laurent - 2014-08-29
    • status: open --> accepted
    • assigned_to: alonso laurent
     
  • alonso laurent

    alonso laurent - 2014-08-29
    • status: accepted --> closed
     

Anonymous
Anonymous

Add attachments
Cancel