Hanno Böck created XERCESC-2051:
-----------------------------------

             Summary: Overlapping memcpy call
                 Key: XERCESC-2051
                 URL: https://issues.apache.org/jira/browse/XERCESC-2051
             Project: Xerces-C++
          Issue Type: Bug
    Affects Versions: 3.1.2
            Reporter: Hanno Böck
            Priority: Minor
         Attachments: xerces-c-overlapping-memcpy.diff

When running the test suite with address sanitizer enabled it will report an 
overlapping memcpy call:

< =================================================================
< ==8236==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges 
[0x0000006678c0,0x0000006678ca) and [0x0000006678c2, 0x0000006678cc) overlap
<     #0 0x7f1025853f24 
(/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/libasan.so.1+0x2ff24)
<     #1 0x7f1024df4bf8 in xercesc_3_1::XMLString::moveChars(unsigned short*, 
unsigned short const*, unsigned long) xercesc/util/XMLString.hpp:1446
<     #2 0x7f1024e627eb in xercesc_3_1::XMLString::collapseWS(unsigned short*, 
xercesc_3_1::MemoryManager*) xercesc/util/XMLString.cpp:1813
<     #3 0x44a098 in DOMTest::testUtilFunctions() src/DOM/DOMTest/DTest.cpp:5752
<     #4 0x412865 in main src/DOM/DOMTest/DTest.cpp:984
<     #5 0x7f10209b5f9f in __libc_start_main (/lib64/libc.so.6+0x1ff9f)
<     #6 0x405848 (/tmp/xerces-c-3.1.2/tests/.libs/DOMTest+0x405848)
< 
< 0x0000006678c0 is located 0 bytes inside of global variable 'tempStr' from 
'src/DOM/DOMTest/DTest.cpp' (0x6678c0) of size 8000
< 0x0000006678c2 is located 2 bytes inside of global variable 'tempStr' from 
'src/DOM/DOMTest/DTest.cpp' (0x6678c0) of size 8000
< SUMMARY: AddressSanitizer: memcpy-param-overlap ??:0 ??
< ==8236==ABORTING

memcpy calls to overlapping memory areas are not allowed. memmove can be used 
in such instances. (I'll attach a patch that changes that, but I'd ask for it 
to be reviewed by someone familiar with the code and check whether the 
overlapping copying is really intended.)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: c-dev-h...@xerces.apache.org

Reply via email to