Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C0679985A for ; Mon, 26 Mar 2012 16:07:59 +0000 (UTC) Received: (qmail 7773 invoked by uid 500); 26 Mar 2012 16:07:59 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 7744 invoked by uid 500); 26 Mar 2012 16:07:59 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 7737 invoked by uid 99); 26 Mar 2012 16:07:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2012 16:07:59 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Mar 2012 16:07:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8406B238896F; Mon, 26 Mar 2012 16:07:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1305420 - /incubator/ooo/trunk/main/desktop/source/deployment/dp_persmap.cxx Date: Mon, 26 Mar 2012 16:07:38 -0000 To: ooo-commits@incubator.apache.org From: hdu@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120326160738.8406B238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hdu Date: Mon Mar 26 16:07:38 2012 New Revision: 1305420 URL: http://svn.apache.org/viewvc?rev=1305420&view=rev Log: #i119113# fix of-by-one when importing BDB files Modified: incubator/ooo/trunk/main/desktop/source/deployment/dp_persmap.cxx Modified: incubator/ooo/trunk/main/desktop/source/deployment/dp_persmap.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/desktop/source/deployment/dp_persmap.cxx?rev=1305420&r1=1305419&r2=1305420&view=diff ============================================================================== --- incubator/ooo/trunk/main/desktop/source/deployment/dp_persmap.cxx (original) +++ incubator/ooo/trunk/main/desktop/source/deployment/dp_persmap.cxx Mon Mar 26 16:07:38 2012 @@ -399,7 +399,9 @@ bool PersistentMap::importFromBDB() // parse the next _db_page const sal_uInt8* const pPage = &aRawBDB[ nPgNo * nPgSize]; const sal_uInt8* const pEnd = pPage + nPgSize; - const int nHfOffset = bLE ? (pPage[22] + (pPage[23]<<8)) : (pPage[23] + (pPage[22]<<8)); + const int nHfOffset = bLE ? (pPage[22] + (pPage[23]<<8)) : (pPage[23] + (pPage[22]<<8)); + if( nHfOffset <= 0) + continue; const sal_uInt8* pCur = pPage + nHfOffset; // iterate through the entries for(; pCur < pEnd; ++pCur) { @@ -423,6 +425,7 @@ bool PersistentMap::importFromBDB() if( (pCur < pEnd) && (*pCur > 0x01)) continue; const OString aKey( (sal_Char*)pKey, pCur - pKey); + --pCur; // prepare for next round by rewinding to end of key-string // add the key/value pair add( aKey, aVal);