Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#141 Libwv2 core dump with read protected files

open
nobody
None
5
2005-06-20
2005-06-20
Anonymous
No

A simple test case consist to create a word document
with a read password protection. This make libwv2
coredumps while parsing styles. This also happens with
recent versions of Kword.

This coredump occurs while informations are read during
the init
function of parser9x.cpp.

I wonder if the treatments in this function are really
necessary,
as libwv2 does however not deal with read protected
word docs.

As a work around, i suggest testing the document in the
beginning of the init process to see if it is read
protected.

In case the document is protected, init stops, and
m_okay is set to false.

This work around is a quick fix, and may not be the
best one,
but it would be great if it (or another better fix)
could be set
in a next release, as other workaround are difficult to
maintain
(needs to include a lot of files from different
libraries, and break the simplicity of using this
wonderfull parser).

Here is a little dirty patch against the lattest revision:
--- parser9x.cpp.~1.41.~ 2004-01-31 10:12:51.000000000
+0100
+++ parser9x.cpp 2005-06-20 14:00:49.000000000 +0200
@@ -285,6 +285,15 @@

void Parser9x::init()
{
+ if ( m_fib.fEncrypted ) {
+ // There is some code out there to break this
"encryption", do we want
+ // to implement that?
+ // We could either ask for a password or cheat
a bit :-)
+ wvlog << "Error: The document is encrypted."
<< std::endl;
+ m_okay = false ;
+ return ;
+ }
+
if ( m_fib.fFarEast )
m_textconverter = new TextConverter(
m_fib.lidFE );
else

However thanks for all this great work.

Olivier

thevenin@antidot.net

Discussion

  • Patch to avoid coredump

     
    Attachments