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

SVG data:URIs with length > ~700 chars and an unescaped newline will hang the parser #50

Open
RoyTinker opened this issue Apr 5, 2017 · 0 comments

Comments

@RoyTinker
Copy link

This problem is most prevalent when embedding SVG files as data:URIs. Sometimes a newline slips through without an escape. The following will hang PrettyCSS:

.svg-icon {
    background-image: url("data:image/svg+xml,\
        %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E\
        %3Cpath d='M224%20387.814V512L32 320l192-192v126.912C447.375 \
            260.152 437.794 103.016 380.93 0 521.287 151.707 491.48 394.785 224 \
            387.814z'/%3E%\
        %3Cpath d='M224%20387.814V512L32 320l192-192v126.912C447.375 \
            260.152 437.794 103.016 380.93 0 521.287 151.707 491.48 394.785 224 \
            387.814z'/%3E%\
        %3Cpath d='M224%20387.814V512L32 320l192-192v126.912C447.375 \
            260.152 437.794 103.016 380.93 0 521.287 151.707 491.48 394.785 224 \
            387.814z'/%3E%\
        %3Cpath d='M224%20387.814V512L32 320l192-192v126.912C447.375 \
            260.152 437.794 103.016 380.93 0 521.287 151.707 491.48 394.785 224 \
            387.814z'/%3E\
        %3C/svg%3E
");
}

The unescaped newline is right before the end quote.

@RoyTinker RoyTinker changed the title Long SVG data:URIs with an unescaped newline hang the parser SVG data:URIs with length > ~800 chars with an unescaped newline will hang the parser Apr 5, 2017
@RoyTinker RoyTinker changed the title SVG data:URIs with length > ~800 chars with an unescaped newline will hang the parser SVG data:URIs with length > ~700 chars with an unescaped newline will hang the parser Apr 5, 2017
@RoyTinker RoyTinker changed the title SVG data:URIs with length > ~700 chars with an unescaped newline will hang the parser data:URIs with length > ~700 chars with an unescaped newline will hang the parser Apr 5, 2017
@RoyTinker RoyTinker changed the title data:URIs with length > ~700 chars with an unescaped newline will hang the parser SVG data:URIs with length > ~700 chars and an unescaped newline will hang the parser Apr 5, 2017
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

1 participant