<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>184542</bug_id>
          
          <creation_ts>2018-04-12 09:03:14 -0700</creation_ts>
          <short_desc>CSS variables (custom properties) bug &amp; a potential crash</short_desc>
          <delta_ts>2025-09-06 06:37:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>CSS</component>
          <version>Safari 11</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>CONFIGURATION CHANGED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>190039</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Roman Komarov">kizmarh</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>emilio</cc>
    
    <cc>jonlee</cc>
    
    <cc>justin_michaud</cc>
    
    <cc>koivisto</cc>
    
    <cc>rniwa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>twilco.o</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1414031</commentid>
    <comment_count>0</comment_count>
      <attachid>337803</attachid>
    <who name="Roman Komarov">kizmarh</who>
    <bug_when>2018-04-12 09:03:14 -0700</bug_when>
    <thetext>Created attachment 337803
Crash page

Steps to reproduce:

Go to https://codepen.io/kizu/pen/MVRRMq (I have managed to reproduce both the bug and the crash both on desktop and mobile safari)

In every other browser (including Chrome) the header should have a lime background, but in Safari it gets the pink one.

Its also possible to cause this page to crash when creating circularity (uncomment the commented line in the above example, or go to https://codepen.io/kizu/pen/OvGYXx, or open an attached page), which is probably related to the above bug as every other browser handle this without crashing (and properly displaying pink background as --foo becomes invalid).

Due to crash being caused by really short CSS string which is possible to pass just as a style attribute to an HTML element, I think it could be really dangerous.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1414038</commentid>
    <comment_count>1</comment_count>
    <who name="Roman Komarov">kizmarh</who>
    <bug_when>2018-04-12 09:12:12 -0700</bug_when>
    <thetext>Found the minimal CSS that causes the crash:

    *{--:var(---,var(--))}</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1414051</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2018-04-12 09:52:58 -0700</bug_when>
    <thetext>Looks like infinite recursion. Not sure if the crash and the bug are closely enough related to track in one issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1414052</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-04-12 09:53:21 -0700</bug_when>
    <thetext>&lt;rdar://problem/39384155&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1414058</commentid>
    <comment_count>4</comment_count>
    <who name="Roman Komarov">kizmarh</who>
    <bug_when>2018-04-12 10:12:50 -0700</bug_when>
    <thetext>Yes, not sure if they related, but seem to be in both cases related to the variable&apos;s fallback, but feel free to split into a new one anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1466048</commentid>
    <comment_count>5</comment_count>
    <who name="Roman Komarov">kizmarh</who>
    <bug_when>2018-10-03 07:14:23 -0700</bug_when>
    <thetext>Any news about this?

I find that having a case where 22-characters if CSS cause a crash to be rather dangerous, as it could be possible to use it as an attack, by inserting it somewhere where you have an access to CSS/HTML, and via it basically disabling the browsing experience for anyone using Safari.

Also, a question: is it something that would be safe to write about in social networks, so people would know that this is possible and could potentially protect themselves by stripping CSS variables from any user-generated fields, and also as an interesting anecdote about the circularity in CSS?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1694498</commentid>
    <comment_count>6</comment_count>
    <who name="Tyler Wilcock">twilco.o</who>
    <bug_when>2020-10-03 22:07:04 -0700</bug_when>
    <thetext>I can&apos;t reproduce this in Safari Version 14.0 (15610.1.28.1.9, 15610).  I get a lime green background, and no crash from the Codepen nor the minimal CSS you&apos;ve provided.  Can you confirm whether or not this is still an issue?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1892744</commentid>
    <comment_count>7</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-08-20 17:35:18 -0700</bug_when>
    <thetext>I am not able to reproduce any crash with test case in Safari 15.6.1 and Safari Technology Preview 151 but I don&apos;t get &quot;Lime&quot; background but light reddish / pinkish background and it is same as other browsers (Chrome Canary 106 and Firefox Nightly 105).

Please mark this bug accordingly. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2141356</commentid>
    <comment_count>8</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2025-09-05 16:19:38 -0700</bug_when>
    <thetext>@Roman - is this reproducing for you?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2141432</commentid>
    <comment_count>9</comment_count>
    <who name="Roman Komarov">kizmarh</who>
    <bug_when>2025-09-06 01:56:32 -0700</bug_when>
    <thetext>Seems to be working now!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>337803</attachid>
            <date>2018-04-12 09:03:14 -0700</date>
            <delta_ts>2018-04-12 09:03:14 -0700</delta_ts>
            <desc>Crash page</desc>
            <filename>safari-crash.html</filename>
            <type>text/html</type>
            <size>395</size>
            <attacher name="Roman Komarov">kizmarh</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ImVuIiA+Cgo8aGVhZD4KCiAgPG1ldGEgY2hhcnNl
dD0iVVRGLTgiPgogIDx0aXRsZT5Db2RlUGVuIC0gU2FmYXJpIHZhcmlhYmxlcyBidWc6IGNyYXNo
PC90aXRsZT4KICAgICAgPHN0eWxlPgogICAgICBoMiB7CiAgYmFja2dyb3VuZDogdmFyKC0tZm9v
LCBwaW5rKTsKICAtLWZvbzogdmFyKC0tYmFyLCBsaW1lKTsKICAtLWJhcjogdmFyKC0tYmF6LCB2
YXIoLS1mb28pKTsKfQogICAgPC9zdHlsZT4KPC9oZWFkPgoKPGJvZHkgdHJhbnNsYXRlPSJubyIg
PgoKICA8aDI+VGhpcyB0ZXh0IHNob3VsZCBoYXZlIGxpbWUgYmFja2dyb3VuZDwvaDI+CjxwPklu
IFNhZmFyaSB0aGVyZSBpcyBhIGNyYXNoLjwvcD4KCgoKCgoKPC9ib2R5PgoKPC9odG1sPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>