Fix segfault with expression bindings on database backends #5161

Closed
wants to merge 1 commit into
from

Projects

None yet

3 participants

@mkofahl
Contributor
mkofahl commented Sep 8, 2015

In some situations, attribute bindings may cause a segmentation fault, when executing multiple MapScript operations, e.g. queryByPoint() followed by draw() on the same layer. This is because the expression is tokenized only once - when uninitialized. In case of an attribute binding, the token bindval index points to the sql column-index built from the list of required attributes, in case of queryByPoint() all attributes are requested. A possibly following draw() will reduce the number of attributes to be queried from the database, so the column index in the resultset changes, but the expression token is still the same.

The fix is to free the expression object, when msLayerFreeItemInfo() is called, which is currently done at LayerClose() only.

@mkofahl mkofahl added a commit to faegi/mapserver that referenced this pull request Sep 30, 2015
@mkofahl mkofahl Free expression tokens, which may store an index to an iteminfo, when…
… iteminfo is freed. (#5161)
08d9b18
@mkofahl mkofahl Free expression tokens, which may store an index to an iteminfo, when…
… iteminfo is freed. (#5161)
045beb0
@mkofahl
Contributor
mkofahl commented Oct 20, 2015

@tbonfort Looks good to me now.

@tbonfort
Member

@sdlime can you please check this is OK for 7.0.1 ?

@sdlime
Member
sdlime commented Dec 1, 2016

Thomas: Missed this one. Ok to include IMHO... --Steve

@tbonfort tbonfort added a commit that referenced this pull request Dec 5, 2016
@mkofahl @tbonfort mkofahl + tbonfort Free expression tokens, which may store an index to an iteminfo, when…
… iteminfo is freed. (#5161)
7413952
@tbonfort tbonfort added this to the 7.0.3 Release milestone Dec 5, 2016
@tbonfort
Member
tbonfort commented Dec 5, 2016

Applied to branch-7-0 in 7413952

@tbonfort tbonfort closed this Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment