<?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>187468</bug_id>
          
          <creation_ts>2018-07-09 07:59:44 -0700</creation_ts>
          <short_desc>valgrind claims memcpy overlap in CSSPropertyParser.cpp</short_desc>
          <delta_ts>2018-07-10 02:56:42 -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>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>INVALID</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Milan Crha">mcrha</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>calvaris</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1440380</commentid>
    <comment_count>0</comment_count>
    <who name="Milan Crha">mcrha</who>
    <bug_when>2018-07-09 07:59:44 -0700</bug_when>
    <thetext>I noticed this claim (among of several other) with webkit2gtk3-2.20.3-1.fc28.x86_64:

==2082== Source and destination overlap in memcpy_chk(0x1ffeffbbd7, 0x1ffeffbbd6, 8)
==2082==    at 0x4C36490: __memcpy_chk (vg_replace_strmem.c:1581)
==2082==    by 0x602E331: UnknownInlinedFun (string_fortified.h:40)
==2082==    by 0x602E331: cssValueKeywordID&lt;char16_t&gt; (CSSPropertyParser.cpp:184)
==2082==    by 0x602E331: WebCore::cssValueKeywordID(WTF::StringView) (CSSPropertyParser.cpp:202)
==2082==    by 0x602E495: WebCore::CSSParserToken::id() const [clone .part.152] (CSSParserToken.cpp:309)
==2082==    by 0x60501DB: WebCore::CSSPropertyParser::consumeCSSWideKeyword(WebCore::CSSPropertyID, bool) (CSSPropertyParser.cpp:342)
==2082==    by 0x6058B08: WebCore::CSSPropertyParser::parseValueStart(WebCore::CSSPropertyID, bool) (CSSPropertyParser.cpp:302)
==2082==    by 0x6058DD9: WebCore::CSSPropertyParser::parseValue(WebCore::CSSPropertyID, bool, WebCore::CSSParserTokenRange const&amp;, WebCore::CSSParserContext const&amp;, WTF::Vector&lt;WebCore::CSSProperty, 256ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc&gt;&amp;, WebCore::StyleRuleBase::Type) (CSSPropertyParser.cpp:267)
==2082==    by 0x60220FD: WebCore::CSSParserImpl::consumeDeclarationValue(WebCore::CSSParserTokenRange, WebCore::CSSPropertyID, bool, WebCore::StyleRuleBase::Type) (CSSParserImpl.cpp:857)
==2082==    by 0x602677E: WebCore::CSSParserImpl::consumeDeclaration(WebCore::CSSParserTokenRange, WebCore::StyleRuleBase::Type) (CSSParserImpl.cpp:840)
==2082==    by 0x6027DA9: WebCore::CSSParserImpl::consumeDeclarationList(WebCore::CSSParserTokenRange, WebCore::StyleRuleBase::Type) (CSSParserImpl.cpp:778)
==2082==    by 0x6029094: WebCore::CSSParserImpl::consumeStyleRule(WebCore::CSSParserTokenRange, WebCore::CSSParserTokenRange) (CSSParserImpl.cpp:747)
==2082==    by 0x602956E: WebCore::CSSParserImpl::consumeQualifiedRule(WebCore::CSSParserTokenRange&amp;, WebCore::CSSParserImpl::AllowedRulesType) (CSSParserImpl.cpp:473)
==2082==    by 0x602A331: consumeRuleList&lt;WebCore::CSSParserImpl::parseStyleSheet(const WTF::String&amp;, const WebCore::CSSParserContext&amp;, WebCore::StyleSheetContents*, WebCore::CSSParser::RuleParsing)::&lt;lambda(WTF::RefPtr&lt;WebCore::StyleRuleBase&gt;)&gt; &gt; (CSSParserImpl.cpp:387)
==2082==    by 0x602A331: WebCore::CSSParserImpl::parseStyleSheet(WTF::String const&amp;, WebCore::CSSParserContext const&amp;, WebCore::StyleSheetContents*, WebCore::CSSParser::RuleParsing) (CSSParserImpl.cpp:245)

The other claims are from /usr/lib64/libjavascriptcoregtk-4.0.so.18.7.11 (I do have webkit2gtk3-jsc-debuginfo-2.20.3-1.fc28.x86_64 installed, but it still shows only the library file for some reason) about invalid writes and use of uninitialized memory, but I do not want to mix it here. If you&apos;d like a new bug for those, even without line numbers, then I can file it, but I&apos;m afraid missing line numbers is a pita, thus I didn&apos;t do it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1440384</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-07-09 08:16:05 -0700</bug_when>
    <thetext>This is memmove, not memcpy, so the source and destination are allowed to overlap....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1440386</commentid>
    <comment_count>2</comment_count>
    <who name="Milan Crha">mcrha</who>
    <bug_when>2018-07-09 08:21:02 -0700</bug_when>
    <thetext>Do you mean this had been addressed after 2.20.3 release already? That would be fine then.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1440558</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2018-07-09 14:27:40 -0700</bug_when>
    <thetext>No, the code in question didn&apos;t change for the last couple years.

        if (isAppleLegacyCssValueKeyword(buffer, length) || hasPrefix(buffer, length, &quot;-khtml-&quot;)) {
            memmove(buffer + 7, buffer + 6, length + 1 - 6); // This is line 184
            memcpy(buffer, &quot;-webkit&quot;, 7);
            ++length;
        }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1440793</commentid>
    <comment_count>4</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2018-07-10 02:56:42 -0700</bug_when>
    <thetext>This seems to be a valgrind bug. I see the memmove() definition in glibc calls GCC&apos;s __builtin___memmove_chk().  valgrind seems to be intercepting that with __memcpy_chk rather than __memmove_chk like it should be... dunno how that&apos;s going wrong. I would report this to the valgrind developers and allow them to figure it out.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>