Changes to pf_Frag_Strux.cpp

From: Volodymyr Rudyj <vladimir.rudoy_at_gmail.com>
Date: Sat Jul 16 2011 - 12:57:00 CEST

Good day !

I need help and little code review. I`m working on improving HTML
exporter (as you know, I`m using it in EPUB plugin). And while
exporting some of the documents to HTML (and as a result to EPUB),
e.g. abiword build instructions, assertion occurs which says that we
tried to access element of the UT_vector by index which is out of
range. I`ve found out that the reason is pf_Frag_Strux::getFmtHandle
method. You can see stack trace at http://pastebin.com/nc6LSPe8 . So
here is a little patch that fixes the problem. So what do you think
about this patch?

Thanks!

### Eclipse Workspace Patch 1.0
#P abiword
Index: src/text/ptbl/xp/pf_Frag_Strux.cpp
===================================================================
--- src/text/ptbl/xp/pf_Frag_Strux.cpp (revision 30045)
+++ src/text/ptbl/xp/pf_Frag_Strux.cpp (working copy)
@@ -55,7 +55,7 @@

 PL_StruxFmtHandle pf_Frag_Strux::getFmtHandle(PL_ListenerId lid) const
 {
- if (m_vecFmtHandle.size() == 0) return 0;
+ if ((m_vecFmtHandle.size() == 0) || (lid >= m_vecFmtHandle.size())) return 0;
         return (PL_StruxFmtHandle)m_vecFmtHandle.getNthItem(lid);
 }
Received on Sat Jul 16 12:57:27 2011

This archive was generated by hypermail 2.1.8 : Sat Jul 16 2011 - 12:57:27 CEST