Kaydet (Commit) 20a7a705 authored tarafından Markus Mohrhard's avatar Markus Mohrhard Kaydeden (comit) Markus Mohrhard

in the old design all lists needed to be the same size, fdo75200

We did not crash in the invalid memory access because the lists were
continuous in memory and we would just pick the next id. However it
crashed when trying to map some of the ids to non existant strings. This
commit also removes the need for the earlier fix for this bug that just
hit the problem behind some checks much later in the call chain.

Change-Id: Ic6658987815c4e84ed2449934c310e30dcd0ed4c
üst bbaad88a
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#include <oox/helper/propertymap.hxx> #include <oox/helper/propertymap.hxx>
#include <oox/dllapi.h> #include <oox/dllapi.h>
#include <vector>
namespace oox { class ModelObjectHelper; } namespace oox { class ModelObjectHelper; }
namespace oox { namespace oox {
...@@ -70,7 +72,7 @@ enum ShapePropertyId ...@@ -70,7 +72,7 @@ enum ShapePropertyId
struct OOX_DLLPUBLIC ShapePropertyInfo struct OOX_DLLPUBLIC ShapePropertyInfo
{ {
const sal_Int32* mpnPropertyIds; /// Pointer to array of property identifiers for all SHAPEPROP properties. std::vector<sal_Int32> maPropertyIds;
bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker. bool mbNamedLineMarker; /// True = use named line marker instead of explicit line marker.
bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash. bool mbNamedLineDash; /// True = use named line dash instead of explicit line dash.
bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient. bool mbNamedFillGradient; /// True = use named fill gradient instead of explicit fill gradient.
...@@ -85,8 +87,8 @@ struct OOX_DLLPUBLIC ShapePropertyInfo ...@@ -85,8 +87,8 @@ struct OOX_DLLPUBLIC ShapePropertyInfo
bool bNamedFillGradient, bool bNamedFillGradient,
bool bNamedFillBitmapUrl ); bool bNamedFillBitmapUrl );
bool has( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ] >= 0; } bool has( ShapePropertyId ePropId ) const { return maPropertyIds.size() > size_t(ePropId) && maPropertyIds[ ePropId ] >= 0; }
sal_Int32 operator[]( ShapePropertyId ePropId ) const { return mpnPropertyIds[ ePropId ]; } sal_Int32 operator[]( ShapePropertyId ePropId ) const { return maPropertyIds[ ePropId ]; }
}; };
......
...@@ -469,7 +469,8 @@ static const sal_Int32 spnCommonPropIds[] = ...@@ -469,7 +469,8 @@ static const sal_Int32 spnCommonPropIds[] =
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, PROP_FillGradientName, PROP_FillStyle, PROP_FillColor, PROP_FillTransparence, PROP_INVALID, PROP_FillGradientName,
PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_END_LIST
}; };
/** Property identifiers for linear data series, to be used in ShapePropertyInfo. */ /** Property identifiers for linear data series, to be used in ShapePropertyInfo. */
...@@ -479,17 +480,37 @@ static const sal_Int32 spnLinearPropIds[] = ...@@ -479,17 +480,37 @@ static const sal_Int32 spnLinearPropIds[] =
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_INVALID, PROP_INVALID, PROP_INVALID PROP_INVALID, PROP_INVALID, PROP_INVALID,
PROP_END_LIST
}; };
/** Property identifiers for filled data series, to be used in ShapePropertyInfo. */ /** Property identifiers for filled data series, to be used in ShapePropertyInfo. */
static const sal_Int32 spnFilledPropIds[] = static const sal_Int32 spnFilledPropIds[] =
{ {
PROP_BorderStyle, PROP_BorderWidth, PROP_BorderColor, PROP_BorderTransparency, PROP_BorderDashName, PROP_BorderStyle,
PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_INVALID, PROP_BorderWidth,
PROP_FillStyle, PROP_Color, PROP_Transparency, PROP_GradientName, PROP_BorderColor,
PROP_FillBitmapName, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, PROP_BorderTransparency,
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint PROP_BorderDashName,
PROP_INVALID,
PROP_INVALID,
PROP_INVALID,
PROP_INVALID,
PROP_INVALID,
PROP_INVALID,
PROP_INVALID,
PROP_FillStyle,
PROP_Color,
PROP_Transparency,
PROP_GradientName,
PROP_FillBitmapName,
PROP_FillBitmapMode,
PROP_FillBitmapSizeX,
PROP_FillBitmapSizeY,
PROP_FillBitmapPositionOffsetX,
PROP_FillBitmapPositionOffsetY,
PROP_FillBitmapRectanglePoint,
PROP_END_LIST
}; };
/** Property info for common chart objects, to be used in ShapePropertyMap. */ /** Property info for common chart objects, to be used in ShapePropertyMap. */
......
...@@ -39,7 +39,7 @@ using namespace ::com::sun::star::uno; ...@@ -39,7 +39,7 @@ using namespace ::com::sun::star::uno;
namespace { namespace {
static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END ] = static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END + 1 ] = // one for the PROP_END_LIST
{ {
PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDash, PROP_LineJoint, PROP_LineStyle, PROP_LineWidth, PROP_LineColor, PROP_LineTransparence, PROP_LineDash, PROP_LineJoint,
PROP_LineStartName, PROP_LineStartWidth, PROP_LineStartCenter, PROP_LineEndName, PROP_LineEndWidth, PROP_LineEndCenter, PROP_LineStartName, PROP_LineStartWidth, PROP_LineStartCenter, PROP_LineEndName, PROP_LineEndWidth, PROP_LineEndCenter,
...@@ -47,7 +47,8 @@ static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END ] = ...@@ -47,7 +47,8 @@ static const sal_Int32 spnDefaultShapeIds[ SHAPEPROP_END ] =
PROP_FillBitmapURL, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY, PROP_FillBitmapURL, PROP_FillBitmapMode, PROP_FillBitmapSizeX, PROP_FillBitmapSizeY,
PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint, PROP_FillBitmapPositionOffsetX, PROP_FillBitmapPositionOffsetY, PROP_FillBitmapRectanglePoint,
PROP_FillHatch, PROP_FillHatch,
PROP_ShadowXDistance PROP_ShadowXDistance,
PROP_END_LIST
}; };
} // namespace } // namespace
...@@ -56,13 +57,19 @@ ShapePropertyInfo ShapePropertyInfo::DEFAULT( spnDefaultShapeIds, true, false, f ...@@ -56,13 +57,19 @@ ShapePropertyInfo ShapePropertyInfo::DEFAULT( spnDefaultShapeIds, true, false, f
ShapePropertyInfo::ShapePropertyInfo( const sal_Int32* pnPropertyIds, ShapePropertyInfo::ShapePropertyInfo( const sal_Int32* pnPropertyIds,
bool bNamedLineMarker, bool bNamedLineDash, bool bNamedFillGradient, bool bNamedFillBitmapUrl ) : bool bNamedLineMarker, bool bNamedLineDash, bool bNamedFillGradient, bool bNamedFillBitmapUrl ) :
mpnPropertyIds( pnPropertyIds ),
mbNamedLineMarker( bNamedLineMarker ), mbNamedLineMarker( bNamedLineMarker ),
mbNamedLineDash( bNamedLineDash ), mbNamedLineDash( bNamedLineDash ),
mbNamedFillGradient( bNamedFillGradient ), mbNamedFillGradient( bNamedFillGradient ),
mbNamedFillBitmapUrl( bNamedFillBitmapUrl ) mbNamedFillBitmapUrl( bNamedFillBitmapUrl )
{ {
OSL_ENSURE( mpnPropertyIds != 0, "ShapePropertyInfo::ShapePropertyInfo - missing property identifiers" ); assert(pnPropertyIds);
for(size_t i = 0;; ++i)
{
if(pnPropertyIds[i] == PROP_END_LIST)
break;
maPropertyIds.push_back(pnPropertyIds[i]);
}
} }
......
...@@ -53,6 +53,7 @@ foreach( sort( keys( %props ) ) ) ...@@ -53,6 +53,7 @@ foreach( sort( keys( %props ) ) )
print( IDFILE "const sal_Int32 PROP_COUNT = $i;\n" ); print( IDFILE "const sal_Int32 PROP_COUNT = $i;\n" );
print( IDFILE "const sal_Int32 PROP_INVALID = -1;\n" ); print( IDFILE "const sal_Int32 PROP_INVALID = -1;\n" );
print( IDFILE "const sal_Int32 PROP_END_LIST = -2;\n" );
close( IDFILE ); close( IDFILE );
close( NAMEFILE ); close( NAMEFILE );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment