[Libreoffice-commits] core.git: 3 commits - sc/inc sc/source
Eike Rathke
erack at redhat.com
Tue Apr 8 02:55:07 PDT 2014
sc/inc/tabprotection.hxx | 8 +++++++-
sc/source/core/data/tabprotection.cxx | 6 +++---
sc/source/filter/excel/excimp8.cxx | 7 ++++---
sc/source/filter/xcl97/xcl97rec.cxx | 2 +-
4 files changed, 15 insertions(+), 8 deletions(-)
New commits:
commit d114939dabaf5cb0c14b619ef851be17c28e69e5
Author: Eike Rathke <erack at redhat.com>
Date: Tue Apr 8 11:51:19 2014 +0200
resize vector in advance
Obtaining front() from an empty vector is disallowed, even if size was
reserved. So resize it.
Change-Id: Iae2aafd6b7b725ea36bf9c3fb0a2370c7037777f
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index fd8e221..24adc64 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -375,9 +375,10 @@ void ImportExcel8::Feat( void )
{
sal_uInt32 nCbSD = aIn.ReaduInt32();
// TODO: could here be some sanity check applied to not allocate 4GB?
- aProt.maSecurityDescriptor.reserve( nCbSD);
+ aProt.maSecurityDescriptor.resize( nCbSD);
sal_Size nRead = aIn.Read( &aProt.maSecurityDescriptor.front(), nCbSD);
- aProt.maSecurityDescriptor.resize( nRead);
+ if (nRead < nCbSD)
+ aProt.maSecurityDescriptor.resize( nRead);
}
GetSheetProtectBuffer().AppendEnhancedProtection( aProt, GetCurrScTab() );
commit 5bce64e4759ee3bd98d34b70d02f9b54550a53ed
Author: Eike Rathke <erack at redhat.com>
Date: Tue Apr 8 11:34:49 2014 +0200
bit 0 is bit 0
They say they use big-endian bit diagrams, but just to confuse you.
Change-Id: I7fd6bb58c721f1dca2f6ecbaae90d516746762f0
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx
index 8209a86..fd8e221 100644
--- a/sc/source/filter/excel/excimp8.cxx
+++ b/sc/source/filter/excel/excimp8.cxx
@@ -371,7 +371,7 @@ void ImportExcel8::Feat( void )
aProt.mnAreserved = aIn.ReaduInt32();
aProt.mnPasswordVerifier = aIn.ReaduInt32();
aProt.maTitle = aIn.ReadUniString();
- if ((aProt.mnAreserved & 0x80000000) == 0x80000000)
+ if ((aProt.mnAreserved & 0x00000001) == 0x00000001)
{
sal_uInt32 nCbSD = aIn.ReaduInt32();
// TODO: could here be some sanity check applied to not allocate 4GB?
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index d6c39ce..285fc62 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1492,7 +1492,7 @@ void XclExpSheetEnhancedProtection::WriteBody( XclExpStream& rStrm )
rStrm << maEnhancedProtection.mnAreserved; // 1 bit A and 31 bits reserved
rStrm << maEnhancedProtection.mnPasswordVerifier; // wPassword
rStrm << XclExpString( maEnhancedProtection.maTitle); // stTitle
- bool bSDContainer = ((maEnhancedProtection.mnAreserved & 0x80000000) == 0x80000000);
+ bool bSDContainer = ((maEnhancedProtection.mnAreserved & 0x00000001) == 0x00000001);
sal_uInt32 nCbSD = maEnhancedProtection.maSecurityDescriptor.size();
SAL_WARN_IF( bSDContainer && nCbSD < 20, "sc.filter",
"XclExpSheetEnhancedProtection A flag indicates container but cbSD < 20");
commit a65e9fd24d905d03cd77551f2d6c9b2efa18fff6
Author: Eike Rathke <erack at redhat.com>
Date: Tue Apr 8 11:08:30 2014 +0200
hold security descriptors read from OOXML independently
If anyone knows how to interpret that stuff and convert between
BIFF/OOXML feel free to implement..
According to ISO/IEC 29000 the securityDescriptor is application
defined, but recommends that username at domain be used, which is addr-spec
of RFC 822. Well, what Excel2013 writes is something like this
'O:WDG:WDD:(A;;CC;;;S-1-5-21-2328606873-448790680-2149751550-1003)'
Change-Id: I138fa116b019f200c211272abf69831bc49127ab
diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx
index a224dc8..2dc798c 100644
--- a/sc/inc/tabprotection.hxx
+++ b/sc/inc/tabprotection.hxx
@@ -119,9 +119,15 @@ struct ScEnhancedProtection
sal_uInt32 mnAreserved;
sal_uInt32 mnPasswordVerifier;
OUString maTitle;
- ::std::vector< sal_uInt8 > maSecurityDescriptor; // raw data
+ ::std::vector< sal_uInt8 > maSecurityDescriptor; // imported as raw BIFF data
+ OUString maSecurityDescriptorXML; // imported from OOXML
ScEnhancedProtection() : mnAreserved(0), mnPasswordVerifier(0) {}
+
+ bool hasSecurityDescriptor() const
+ {
+ return !maSecurityDescriptor.empty() || !maSecurityDescriptorXML.isEmpty();
+ }
};
/** sheet protection state container
diff --git a/sc/source/core/data/tabprotection.cxx b/sc/source/core/data/tabprotection.cxx
index f8a6a12..a9bfd8f 100644
--- a/sc/source/core/data/tabprotection.cxx
+++ b/sc/source/core/data/tabprotection.cxx
@@ -396,7 +396,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
for (::std::vector<ScEnhancedProtection>::const_iterator it(maEnhancedProtection.begin()),
itEnd(maEnhancedProtection.end()); it != itEnd; ++it)
{
- if ((*it).maSecurityDescriptor.empty() && (*it).maRangeList.Is())
+ if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is())
{
if ((*it).maRangeList->In( rRange))
{
@@ -416,7 +416,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
for (::std::vector<ScEnhancedProtection>::const_iterator it(maEnhancedProtection.begin()),
itEnd(maEnhancedProtection.end()); it != itEnd; ++it)
{
- if ((*it).maSecurityDescriptor.empty() && (*it).maRangeList.Is())
+ if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is())
{
ScRangeList aList( (*it).maRangeList->GetIntersectedRange( rRange));
if (aList.size() == 1 && *aList[0] == rRange)
@@ -437,7 +437,7 @@ bool ScTableProtectionImpl::isBlockEditable( const ScRange& rRange ) const
for (::std::vector<ScEnhancedProtection>::const_iterator it(maEnhancedProtection.begin()),
itEnd(maEnhancedProtection.end()); it != itEnd; ++it)
{
- if ((*it).maSecurityDescriptor.empty() && (*it).maRangeList.Is())
+ if (!(*it).hasSecurityDescriptor() && (*it).maRangeList.Is())
{
// Ranges are editable if no password is assigned.
if (!(*it).mnPasswordVerifier)
More information about the Libreoffice-commits
mailing list