You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to minify a document with an empty body, and with the removeOptionalTags flag set to true, crashes:
> require('html-minifier').minify('<body></body>', { removeOptionalTags: true })
RangeError: Invalid array length
at removeEndTag ([...]/htmlminifier.js:792:21)
at Object.minify ([...]/htmlminifier.js:1051:9)
[...]
The problem seems to be that removeEndTag() is called while buffer is an empty array. index gets set to -1, the loop gets bypassed, but then we try to set buffer.length to -1.
I noticed this issue appear in 1.2.0; it did not happen in 1.1.1.
The text was updated successfully, but these errors were encountered:
Attempting to minify a document with an empty body, and with the removeOptionalTags flag set to true, crashes:
The problem seems to be that
removeEndTag()
is called whilebuffer
is an empty array.index
gets set to -1, the loop gets bypassed, but then we try to setbuffer.length
to -1.I noticed this issue appear in 1.2.0; it did not happen in 1.1.1.
The text was updated successfully, but these errors were encountered: