The root cause is that skip_whitespaces_comments() reports this parse error with error_position = 0, but its CSS and JS callers only treated error_position != 0 as failure. Because of that, the error path was missed when the invalid comment started at byte 0, m.result had already been cleared, and later code dereferenced it, causing a segmentation fault instead of returning a normal parse error.
Expected behavior:
return a clean syntax error like “Unclosed multi-line comment starting in line 1, column 1”.
Actual behavior:
segmentation fault.
The root cause is that
skip_whitespaces_comments()reports this parse error with error_position = 0, but its CSS and JS callers onlytreated error_position != 0as failure. Because of that, the error path was missed when the invalid comment started at byte 0,m.resulthad already been cleared, and later code dereferenced it, causing a segmentation fault instead of returning a normal parse error.Expected behavior:
return a clean syntax error like “Unclosed multi-line comment starting in line 1, column 1”.
Actual behavior:
segmentation fault.