<?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>27902</bug_id>
          
          <creation_ts>2009-07-31 17:01:10 -0700</creation_ts>
          <short_desc>Missing default switch for baselineShift case statement</short_desc>
          <delta_ts>2012-05-28 21:06:50 -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>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>83536</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Trivial</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="James Hawkins">jhawkins</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cmarcelo</cc>
    
    <cc>eric</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>136305</commentid>
    <comment_count>0</comment_count>
    <who name="James Hawkins">jhawkins</who>
    <bug_when>2009-07-31 17:01:10 -0700</bug_when>
    <thetext>case CSSPropertyBaselineShift: {
    switch (svgStyle-&gt;baselineShift()) {
        case BS_BASELINE:
            return CSSPrimitiveValue::createIdentifier(CSSValueBaseline);
        case BS_SUPER:
            return CSSPrimitiveValue::createIdentifier(CSSValueSuper);
        case BS_SUB:
            return CSSPrimitiveValue::createIdentifier(CSSValueSub);
        case BS_LENGTH:
            return svgStyle-&gt;baselineShiftValue();
    }
}
case CSSPropertyGlyphOrientationHorizontal:
    return glyphOrientationToCSSPrimitiveValue(svgStyle-&gt;glyphOrientationHorizontal());

If svgStyle-&gt;baselineShift() does not match any of the above four values, which could only happen if parsing was added for the value and not added here, then we&apos;d return a value from glyphOrientationToCSSPrimitiveValue().  I basically copied the comment and assertion from a couple lines below, which checks for the same case on different level.  Attaching patch shortly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>136308</commentid>
    <comment_count>1</comment_count>
      <attachid>33909</attachid>
    <who name="James Hawkins">jhawkins</who>
    <bug_when>2009-07-31 17:03:04 -0700</bug_when>
    <thetext>Created attachment 33909
Assert on unhandled values for baselineShift</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>136319</commentid>
    <comment_count>2</comment_count>
      <attachid>33909</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-07-31 17:47:05 -0700</bug_when>
    <thetext>Comment on attachment 33909
Assert on unhandled values for baselineShift

By adding the default case, you are turning off the gcc feature that complains if an enum value is not handled in a switch statement.

So you are turning off compile-time detection (under gcc) of the very thing you are trying to catch at runtime.

And compile-time detection is even better, so we don&apos;t want it turned off!

Please put the assertion outside the switch statement instead of adding a default case. Or just drop this while thing, since we&apos;ll catch missing enum values immediately due to gcc&apos;s warning as soon as this file is compiled with gcc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>136718</commentid>
    <comment_count>3</comment_count>
    <who name="James Hawkins">jhawkins</who>
    <bug_when>2009-08-03 11:22:02 -0700</bug_when>
    <thetext>Ok, thanks for letting me know about that.  Would you be opposed to me moving the assert outside the switch statement for the sake of older and/or non-gcc compilers?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>237349</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2010-06-12 15:29:41 -0700</bug_when>
    <thetext>Yes, we can certainly add ASSERT_NOT_REACHED after the switch. That would be beneficial, because even with a compile time check, there can be e.g. memory corruption that results in a value that&apos;s not covered by case statements.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>635548</commentid>
    <comment_count>5</comment_count>
    <who name="Caio Marcelo de Oliveira Filho">cmarcelo</who>
    <bug_when>2012-05-28 21:06:50 -0700</bug_when>
    <thetext>Closing since the assertion suggested in the previous commented was added in bug 83536. The motivation was the same of this bug.

*** This bug has been marked as a duplicate of bug 83536 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>33909</attachid>
            <date>2009-07-31 17:03:04 -0700</date>
            <delta_ts>2010-06-10 17:56:28 -0700</delta_ts>
            <desc>Assert on unhandled values for baselineShift</desc>
            <filename>assert.diff</filename>
            <type>text/plain</type>
            <size>1899</size>
            <attacher name="James Hawkins">jhawkins</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0NjY0NikKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMjEgQEAKKzIwMDktMDctMzEgIEphbWVzIEhhd2tpbnMgIDxqaGF3a2luc0Bnb29n
bGUuY29tPgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAg
IEFzc2VydCBpZiBzdmdTdHlsZS0+YmFzZWxpbmVTaGlmdCByZXR1cm5zIGFuIHVuaGFuZGxlZCB2
YWx1ZSwgYXMgdGhhdAorICAgICAgICB3b3VsZCBtZWFuIGEgdmFsdWUgd2FzIGFkZGVkIGZvciBi
YXNlbGluZVNoaWZ0IHdpdGhvdXQgYmVpbmcgcHJvcGVybHkKKyAgICAgICAgaGFuZGxlZCBpbiBn
ZXRTVkdQcm9wZXJ0eUNTU1ZhbHVlLCByZXN1bHRpbmcgaW4gYSBib2d1cyB2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Jl
ZlB0cjxDU1NWYWx1ZT4gQ1NTQ29tcHV0ZWRTdHlsZURlYwogICAgICAgICAgICAgICAgICAgICBy
ZXR1cm4gQ1NTUHJpbWl0aXZlVmFsdWU6OmNyZWF0ZUlkZW50aWZpZXIoQ1NTVmFsdWVTdWIpOwog
ICAgICAgICAgICAgICAgIGNhc2UgQlNfTEVOR1RIOgogICAgICAgICAgICAgICAgICAgICByZXR1
cm4gc3ZnU3R5bGUtPmJhc2VsaW5lU2hpZnRWYWx1ZSgpOworICAgICAgICAgICAgICAgIGRlZmF1
bHQ6CisgICAgICAgICAgICAgICAgICAgIC8vIElmIHlvdSBjcmFzaCBoZXJlLCBpdCdzIGJlY2F1
c2UgeW91IGFkZGVkIGEgYmFzZWxpbmVTaGlmdAorICAgICAgICAgICAgICAgICAgICAvLyB2YWx1
ZSBhbmQgYXJlIG5vdCBoYW5kbGluZyBpdCBpbiB0aGlzIHN3aXRjaCBzdGF0ZW1lbnQuCisgICAg
ICAgICAgICAgICAgICAgIEFTU0VSVF9XSVRIX01FU1NBR0UoMCwgInVuaW1wbGVtZW50ZWQgYmFz
ZWxpbmVTaGlmdCB2YWx1ZTogJWRcbiIsIHN2Z1N0eWxlLT5iYXNlbGluZVNoaWZ0KCkpOwogICAg
ICAgICAgICAgfQogICAgICAgICB9CiAgICAgICAgIGNhc2UgQ1NTUHJvcGVydHlHbHlwaE9yaWVu
dGF0aW9uSG9yaXpvbnRhbDoK
</data>
<flag name="review"
          id="18092"
          type_id="1"
          status="-"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>