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


Ladies & gentlemen,

can some1 please review & sign-off the attached patch? Since it is a crasher, 
I'd kindly ask for 3 sign-offs and push to 3.4 as well as 3.4.0

It is some fallout from commit 88cf93a5a68a11cab (deprecated container removal 
effort - surprise, surprise) and I wonder how the given code path might have 
ever worked before. That is:

XclImpNameManager::ReadName() -> XclImpName ctor -> ExcelToSc8::Convert() -> 
XclImpNameManager::GetName()

must've in some cases been trying to retrieve object from defined name list 
which is not yet there (since we're still in the process of constructing it). 
But likely the former container just returned NULL and the calling code was 
happy with it, unlike boost::ptr_vector which throws when attempting to 
retrieve object beyond the container size.

I did a brief sanity test to see if we export the same no. of defined names as 
we imported and it seems to have passed.

Thx (for all the fish)

frozenB.
-- 
  \\\\\              Katarina Machalkova    
  \\\\\\\__o          LibO developer
__\\\\\\\'/_          & hedgehog painter
From 96b9a924fa75be562a2d81834b777ce91fd30326 Mon Sep 17 00:00:00 2001
From: Katarina Machalkova <kmachalkova@suse.cz>
Date: Thu, 19 May 2011 16:21:52 +0200
Subject: [PATCH] Fix for fdo#37322 (binary import crash)

Avoid retrieving defined name items on positions >= maNameList.size()
(boost::ptr_vector doesn't like it)
---
 sc/source/filter/excel/xiname.cxx |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sc/source/filter/excel/xiname.cxx b/sc/source/filter/excel/xiname.cxx
index 15bf618..90be4dc 100644
--- a/sc/source/filter/excel/xiname.cxx
+++ b/sc/source/filter/excel/xiname.cxx
@@ -271,7 +271,7 @@ const XclImpName* XclImpNameManager::FindName( const String& rXclName, SCTAB nSc
 const XclImpName* XclImpNameManager::GetName( sal_uInt16 nXclNameIdx ) const
 {
     DBG_ASSERT( nXclNameIdx > 0, "XclImpNameManager::GetName - index must be >0" );
-    return &(maNameList.at( nXclNameIdx - 1 ));
+    return ( nXclNameIdx >= maNameList.size() ) ? NULL : &(maNameList.at( nXclNameIdx - 1 ));
 }
 
 // ============================================================================
-- 
1.7.3.4

Attachment: signature.asc
Description: This is a digitally signed message part.


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.