[Webkit-unassigned] [Bug 23501] Overlapping memcpy in TestDecoder::reset

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jan 27 09:36:31 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=23501





------- Comment #3 from deanm at chromium.org  2009-01-27 09:36 PDT -------
(In reply to comment #2)
> (From update of attachment 27074 [review])
> This is the wrong level to fix this at. The TextEncoding class's assignment
> operator needs to deal with this. Generally, C++ allows you to self-assign, and
> it's the assignment operator's responsibility to deal with that.
> 
> I don't see how memcpy is involved at all in the compiler-generated assignment
> operator. A TextEncoding has a single data member, a const char*, so I can't
> imagine how memcpy gets involved. Is this something specific to some particular

It is not a single member:

        const char* m_name;
        UChar m_backslashAsCurrencySymbol;

The compiler uses memcpy() to implement the copy.  I don't think I am crazy or
have misconfigured development tools:

Dump of assembler code for function
_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE:
0x08809df8 <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+0>:     push  
ebp
0x08809df9 <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+1>:     mov   
ebp,esp
0x08809dfb <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+3>:     sub   
esp,0x18
0x08809dfe <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+6>:     mov   
edx,DWORD PTR [ebp+0x8]
0x08809e01 <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+9>:     mov   
DWORD PTR [esp+0x8],0x6
0x08809e09 <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+17>:    mov   
eax,DWORD PTR [ebp+0xc]
0x08809e0c <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+20>:    mov   
DWORD PTR [esp+0x4],eax
0x08809e10 <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+24>:    mov   
DWORD PTR [esp],edx
0x08809e13 <_ZN7WebCore11TextDecoder5resetERKNS_12TextEncodingE+27>:    call  
0x8052e84 <memcpy at plt>

>From the disassembly, you can easily see the 6 constant passed to memcpy, this
of course is sizeof(TextEncoding), a pointer and a UChar.

> platform? Perhaps you're using a misconfigured development tool that is
> complaining about something that's not a real problem.
> 


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list