less / less.js

Less. The dynamic stylesheet language.
http://lesscss.org
Apache License 2.0
17.02k stars 3.41k forks source link

Additional check to avoid evaluating an expression if it is a comment #3494

Closed rgroothuijsen closed 4 years ago

rgroothuijsen commented 4 years ago

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.

matthew-dean commented 4 years ago

Thanks!