Skip to content

Commit

Permalink
XLSX: avoid adding too many columns to too many existing feataures. F…
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed May 3, 2018
1 parent d95f051 commit 4f3f1fa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions gdal/ogr/ogrsf_frmts/xlsx/ogrxlsxdatasource.cpp
Expand Up @@ -905,6 +905,17 @@ void OGRXLSXDataSource::endElementRow(CPL_UNUSED const char *pszNameIn)
if (apoCurLineValues.size() >
(size_t)poCurLayer->GetLayerDefn()->GetFieldCount())
{
GIntBig nFeatureCount = poCurLayer->GetFeatureCount(false);
if( nFeatureCount > 0 &&
static_cast<size_t>(apoCurLineValues.size() -
poCurLayer->GetLayerDefn()->GetFieldCount()) >
static_cast<size_t>(100000 / nFeatureCount) )
{
CPLError(CE_Failure, CPLE_NotSupported,
"Adding too many columns to too many "
"existing features");
return;
}
for( size_t i = (size_t)poCurLayer->GetLayerDefn()->GetFieldCount();
i < apoCurLineValues.size();
i++ )
Expand Down

0 comments on commit 4f3f1fa

Please sign in to comment.