Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] QgsExpression::referencedAttributeIndexes(): only report valid indices #33927

Merged

Conversation

rouault
Copy link
Contributor

@rouault rouault commented Jan 20, 2020

If the expression was referencing a non-existing field, -1 was returned in the
result set, which caused later crashed in various providers, including the
Spatialite, Postgres, etc..., due to tried to dereference mFields.at(-1)

Discarding invalid indices is what is also done in
QgsFeatureRequest::OrderBy::usedAttributeIndices()

Fixes #33878

@rouault rouault added Bug Either a bug report, or a bug fix. Let's hope for the latter! backport release-3_10 labels Jan 20, 2020
If the expression was referencing a non-existing field, -1 was returned in the
result set, which caused later crashed in various providers, including the
Spatialite, Postgres, etc..., due to tried to dereference mFields.at(-1)

Discarding invalid indices is what is also done in
QgsFeatureRequest::OrderBy::usedAttributeIndices()

Fixes qgis#33878
@rouault rouault force-pushed the expression_referencedAttributeIndexes branch from cfece15 to 9e9c812 Compare January 20, 2020 18:33
…s to non existing fields in filter expression and order by
…ust to references to non existing fields in filter expression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when applying wrong filter to OAFeat layer
3 participants