summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-24 13:03:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-03-24 13:18:37 +0000
commit4e32e8900e59f9751a60d9fdef80cdf7d500f72f (patch)
tree055d10de72c6c5431b3b33018eabc902b5dc5ddd
parentf233ec000bd39a55fc1ac79717b85d6dd103b7d5 (diff)
Resolves: tdf#106724 crash when Title property doesn't already exist
because we just write past the end instead of resizing before hand Change-Id: I4742980a331b14ca39aff8aa6cfc27db154091ff
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c51659eec07f..c64d9de17889 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4373,31 +4373,31 @@ void DomainMapper_Impl::SetFieldResult(OUString const& rResult)
uno::Sequence<beans::PropertyValue> aValues ;
aProperty >>= aValues;
beans::PropertyValue propertyVal;
- bool bTitleFound = false;
- int i=0;
- for (; i < aValues.getLength(); i++)
+ sal_Int32 nTitleFoundIndex = -1;
+ for (sal_Int32 i = 0; i < aValues.getLength(); ++i)
{
propertyVal = aValues[i];
- if(propertyVal.Name == "Title")
+ if (propertyVal.Name == "Title")
{
- bTitleFound = true;
+ nTitleFoundIndex = i;
break;
}
}
- if(bTitleFound)
+ if (nTitleFoundIndex != -1)
{
OUString titleStr;
uno::Any aValue(propertyVal.Value);
aValue >>= titleStr;
titleStr = titleStr + rResult;
propertyVal.Value <<= titleStr;
- aValues[i] = propertyVal;
+ aValues[nTitleFoundIndex] = propertyVal;
}
else
{
+ aValues.realloc(aValues.getLength() + 1);
propertyVal.Name = "Title";
propertyVal.Value <<= rResult;
- aValues[i] = propertyVal;
+ aValues[aValues.getLength() - 1] = propertyVal;
}
xFieldProperties->setPropertyValue("Fields",
uno::makeAny(aValues));