Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault on compressing some css files #12

Closed
PavloKovalov opened this issue Jan 23, 2014 · 6 comments
Closed

Segmentation fault on compressing some css files #12

PavloKovalov opened this issue Jan 23, 2014 · 6 comments

Comments

@PavloKovalov
Copy link

I get 'segmentation fault' when compressing some css files.
Here is my test script:

require_once './library/CssMin.php';

$cssMin = new CssMin();

$testCss = file_get_contents('./themes/cureline/css/reset.css');
$compressed = $cssMin->run($testCss);

echo $compressed;

output:

newtoaster.dev/ (develop) $ php test.php 
Segmentation fault

phpStorm with xDebug attached process to line 93 and then fails
i'll update if got more details

UPD: sorry, this is css that breaks https://gist.github.com/PavloKovalov/8582652

@PavloKovalov
Copy link
Author

in fact the original YUI Compressor library also breaks on this file

@futtta
Copy link

futtta commented Feb 2, 2014

This is probably another stack overflow on PCRE due to recursion in a regex in a preg_replace Pavlo (cfr. #11). If you can identify the line that breaks you can then try to rewrite the regex so PCRE uses less stack.

@PavloKovalov
Copy link
Author

My colleague found workaround for this issue. See #13

@futtta
Copy link

futtta commented Feb 3, 2014

Great! Did you guys run the tests that included in cssmin/tests/ ? Same results?

@tubalmartin
Copy link
Owner

I'll look into this ASAP and report soon.

@tubalmartin
Copy link
Owner

I've inspected the CSS @PavloKovalov linked. It turns out it's invalid/broken CSS and broken CSS will not compress correctly most of the times. Take a look at line 1088. There you can see clearly the url() function is not closed properly and that's why Apache throws a Segmentation Fault error. Close the url() function properly and it compresses correctly.

Change this:

endColorstr='url(data:image/svg+xml;base64,P'

to:

endColorstr='url(data:image/svg+xml;base64,P)'

I'm closing this issue right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants