Subject: | Nasty segfault on minifying comment-only css input |
I was integrating/testing CSS::Minifier::XS with File::Assets and
stumbled onto a nasty bug.
One of my test cases is a .css file with the simple content:
/* Test file "/static/apple.css" */
(containing NO actual css)
For some reason, the test was dying with no input.
Well, long story short, it turns out CSS::Minifer::XS was segfaulting on
comment-only input.
Basically, CSS::Minifier::XS::minify("/* */"); segfaults on my machine
(perl 5.8).
Here is a test file I used:
---
#!/usr/bin/perl -w
use CSS::Minifier::XS qw/minify/;
my $input;
$input = <<_END_;
/* block comments get removed */
/* comments containing the word "copyright" are left in, though */
/* but all other comments are removed */
_END_
$input = <<_END_;
/* */
_END_
print "Before:\n", $input, "\n";
my $output = minify $input;
print "After:\n", $output, "\n";
---
Let me know if you need more information
Thanks,
Rob