Skip to content

stylesheet parsing bug? @charset "UTF-8"; #74

@powof2

Description

@powof2

while parsing the following stylesheet:

<style type="text/css">
	@charset "UTF-8";
	body
	{
		margin:0;
		padding:0;
		color:#303030;
		background-color:#2d323f;
	}

	img.screenshot
	{
		border:0px;
		padding:0px;
	}
</style>

the stylesheet parser will perfectly skip the "body" section and go directly to its following part "img.screenshot".

while debugging i found the problem is here in stylesheet.cpp (void litehtml::css::parse_stylesheet)

while(pos != tstring::npos && text[pos] == _t('@'))
{
	tstring::size_type sPos = pos;
	pos = text.find_first_of(_t("{"), pos); // <---- why not trying to find matching ';' for @charset 'UTF-8'
	if(pos != tstring::npos && text[pos] == _t('{'))
	{
		pos = find_close_bracket(text, pos, _t('{'), _t('}'));
	}
	if(pos != tstring::npos)
	{
		parse_atrule(text.substr(sPos, pos - sPos + 1), baseurl, doc, media);
	} else
	{
		parse_atrule(text.substr(sPos), baseurl, doc, media);
	}

	if(pos != tstring::npos)
	{
		pos = text.find_first_not_of(_t(" \n\r\t"), pos + 1);
	}
}

thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy