Additional check to avoid evaluating an expression if it is a comment #3494
+8
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While investigating #3443, it was found that the evaluation of the expression became stuck in an infinite loop, filling up the
entities
array until Less runs out of memory. The cause appears to be the attempted evaluation of a comment as an entity, which should have been caught just beforehand but for some reason wasn't. Maybe an issue with cleaning up the loop variable?A second check has now been added to the entity retrieval, since an entity can also be a comment. This fix removes the value from
e
if that is the case, preventing the infinite loop.