mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
Fix an array out of bounds access when committing data (#3807)
This fixes an array out of bounds access when using a layer that consists of a main table with joined in attributes. The provider only tracks the attributes in the main table, but any joined in attributes is also passed to the provider. As the feature attributes is used to govern loop access, there will be an out of bounds access when the first joint attribute is encountered. The fix is borrowed from the postgres provider which stops looping through the passed in feature attributes when the limit of table attributes has been met.
This commit is contained in:
parent
91b03a9c9f
commit
6eb330e2b2
@ -818,6 +818,9 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList & flist )
|
||||
|
||||
for ( int i = 0; i < attrs.count(); ++i )
|
||||
{
|
||||
if ( i >= mAttributeFields.count() )
|
||||
break;
|
||||
|
||||
QgsField fld = mAttributeFields.at( i );
|
||||
|
||||
if ( fld.typeName().endsWith( QLatin1String( " identity" ), Qt::CaseInsensitive ) )
|
||||
@ -889,6 +892,9 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList & flist )
|
||||
|
||||
for ( int i = 0; i < attrs.count(); ++i )
|
||||
{
|
||||
if ( i >= mAttributeFields.count() )
|
||||
break;
|
||||
|
||||
QgsField fld = mAttributeFields.at( i );
|
||||
|
||||
if ( fld.typeName().endsWith( QLatin1String( " identity" ), Qt::CaseInsensitive ) )
|
||||
|
Loading…
x
Reference in New Issue
Block a user