MantisBT - Open CASCADE
View Issue Details
0031008Open CASCADE[OCCT] OCCT:Application Frameworkpublic2019-09-28 09:122020-12-02 17:12
abv 
abv 
normalminor 
closedfixed 
 
[OCCT] 7.5.0[OCCT] 7.5.0 
Not needed
0031008: Application Framework - memcpy-param-overlap reported by Clang address sanitizer in LDOM_XmlReader::ReadRecord()
When running OCCT built on Linux with Clang with option -fsanitize=address, error memcpy-param-overlap is reported on test bugs caf bug27454:

Open /mnt/d/ABV/OCCT/occt_tests_data/private/customers/ASML/bug27454_test.xml D -stream
=================================================================
<table><tr><td bgcolor="ff8080">==5864==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x62a000030238,0x62a00003023f) and [0x62a00003023e, 0x62a000030245) overlap</td></tr></table>
    #0 0x4dd619 in __asan_memcpy (/home/abv/tmp/occt-clang/lin64/clang/bini/DRAWEXE-7.4.0+0x4dd619)
    0000001 0x7f515bba9ea6 in LDOM_XmlReader::ReadRecord(std::istream&, LDOM_OSStream&) /home/abv/occt/src/LDOM/LDOM_XmlReader.cxx:123:11
    0000002 0x7f515bbb0478 in ReadRecord(LDOM_XmlReader&, std::istream&, LDOM_OSStream&) /home/abv/occt/src/LDOM/LDOMParser.cxx:64:52
    #3 0x7f515bbafbe6 in LDOMParser::ParseElement(std::istream&) /home/abv/occt/src/LDOM/LDOMParser.cxx:266:40
    #4 0x7f515bbafd04 in LDOMParser::ParseElement(std::istream&) /home/abv/occt/src/LDOM/LDOMParser.cxx:291:17
    #5 0x7f515bbafd04 in LDOMParser::ParseElement(std::istream&) /home/abv/occt/src/LDOM/LDOMParser.cxx:291:17
    #6 0x7f515bbafd04 in LDOMParser::ParseElement(std::istream&) /home/abv/occt/src/LDOM/LDOMParser.cxx:291:17
    0000007 0x7f515bbafd04 in LDOMParser::ParseElement(std::istream&) /home/abv/occt/src/LDOM/LDOMParser.cxx:291:17
    0000008 0x7f515bbaf4ce in LDOMParser::ParseDocument(std::istream&, bool) /home/abv/occt/src/LDOM/LDOMParser.cxx:225:19
    0000009 0x7f515bbaf248 in LDOMParser::parse(std::istream&, bool, bool) /home/abv/occt/src/LDOM/LDOMParser.cxx:127:10
    #10 0x7f515bb826ef in TryXmlDriverType(std::istream&) /home/abv/occt/src/PCDM/PCDM_ReadWriter.cxx:234:17
    0000011 0x7f515bb82176 in PCDM_ReadWriter::FileFormat(std::istream&, opencascade::handle<Storage_Data>&) /home/abv/occt/src/PCDM/PCDM_ReadWriter.cxx:171:12
    #12 0x7f515bb906e4 in CDF_Application::Read(std::istream&) /home/abv/occt/src/CDF/CDF_Application.cxx:334:15
    0000013 0x7f515bf0fadb in TDocStd_Application::Open(std::istream&, opencascade::handle<TDocStd_Document>&) /home/abv/occt/src/TDocStd/TDocStd_Application.cxx:326:70
    0000014 0x7f515da407bf in DDocStd_Open(Draw_Interpretor&, int, char const**) /home/abv/occt/src/DDocStd/DDocStd_ApplicationCommands.cxx:159:22
    0000015 0x7f5170405349 in Draw_Interpretor::CallBackDataFunc::Invoke(Draw_Interpretor&, int, char const**) /home/abv/occt/src/Draw/Draw_Interpretor.hxx:81:31
    0000016 0x7f5170412b7d in CommandCmd(void*, Tcl_Interp*, int, char const**) /home/abv/occt/src/Draw/Draw_Interpretor.cxx:154:40
    0000017 0x7f516a7a2b95 in TclInvokeStringCommand (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0x38b95)
    0000018 0x7f516a7a4fa6 in TclNRRunCallbacks (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0x3afa6)
    0000019 0x7f516a84387a in Tcl_RecordAndEvalObj (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0xd987a)
    0000020 0x7f516a843756 in Tcl_RecordAndEval (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0xd9756)
    0000021 0x7f51704140bf in Draw_Interpretor::RecordAndEval(char const*, int) /home/abv/occt/src/Draw/Draw_Interpretor.cxx:496:10
    0000022 0x7f51703fadad in Draw_Interprete(char const*) /home/abv/occt/src/Draw/Draw.cxx:608:19
    0000023 0x7f51703fbb90 in interpreteTclCommand(TCollection_AsciiString const&) /home/abv/occt/src/Draw/Draw.cxx:110:5
    0000024 0x7f51703f937b in ReadInitFile(TCollection_AsciiString const&) /home/abv/occt/src/Draw/Draw.cxx:121:3
    0000025 0x7f51703f8973 in Draw_Appli(int, char**, void (*)(Draw_Interpretor&)) /home/abv/occt/src/Draw/Draw.cxx:497:5
    #26 0x7f5170415328 in Draw_Main(int, char**, void (*)(Draw_Interpretor&)) /home/abv/occt/src/Draw/Draw_Main.cxx:113:3
    #27 0x51aaef in main /home/abv/occt/src/DRAWEXE/DRAWEXE.cxx:33:1
    #28 0x7f51691ce82f in __libc_start_main /build/glibc-Cl5G7W/glibc-2.23/csu/../csu/libc-start.c:291
    0000029 0x41aac8 in _start (/home/abv/tmp/occt-clang/lin64/clang/bini/DRAWEXE-7.4.0+0x41aac8)

0x62a000030238 is located 56 bytes inside of 20544-byte region [0x62a000030200,0x62a000035240)
allocated by thread T0 here:
    #0 0x516768 in operator new(unsigned long) (/home/abv/tmp/occt-clang/lin64/clang/bini/DRAWEXE-7.4.0+0x516768)
    0000001 0x7f515bbaf214 in LDOMParser::parse(std::istream&, bool, bool) /home/abv/occt/src/LDOM/LDOMParser.cxx:124:14
    0000002 0x7f515bb826ef in TryXmlDriverType(std::istream&) /home/abv/occt/src/PCDM/PCDM_ReadWriter.cxx:234:17
    #3 0x7f515bb82176 in PCDM_ReadWriter::FileFormat(std::istream&, opencascade::handle<Storage_Data>&) /home/abv/occt/src/PCDM/PCDM_ReadWriter.cxx:171:12
    #4 0x7f515bb906e4 in CDF_Application::Read(std::istream&) /home/abv/occt/src/CDF/CDF_Application.cxx:334:15
    #5 0x7f515bf0fadb in TDocStd_Application::Open(std::istream&, opencascade::handle<TDocStd_Document>&) /home/abv/occt/src/TDocStd/TDocStd_Application.cxx:326:70
    #6 0x7f515da407bf in DDocStd_Open(Draw_Interpretor&, int, char const**) /home/abv/occt/src/DDocStd/DDocStd_ApplicationCommands.cxx:159:22
    0000007 0x7f5170405349 in Draw_Interpretor::CallBackDataFunc::Invoke(Draw_Interpretor&, int, char const**) /home/abv/occt/src/Draw/Draw_Interpretor.hxx:81:31
    0000008 0x7f5170412b7d in CommandCmd(void*, Tcl_Interp*, int, char const**) /home/abv/occt/src/Draw/Draw_Interpretor.cxx:154:40
    0000009 0x7f516a7a2b95 in TclInvokeStringCommand (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0x38b95)

0x62a00003023e is located 62 bytes inside of 20544-byte region [0x62a000030200,0x62a000035240)
allocated by thread T0 here:
    #0 0x516768 in operator new(unsigned long) (/home/abv/tmp/occt-clang/lin64/clang/bini/DRAWEXE-7.4.0+0x516768)
    0000001 0x7f515bbaf214 in LDOMParser::parse(std::istream&, bool, bool) /home/abv/occt/src/LDOM/LDOMParser.cxx:124:14
    0000002 0x7f515bb826ef in TryXmlDriverType(std::istream&) /home/abv/occt/src/PCDM/PCDM_ReadWriter.cxx:234:17
    #3 0x7f515bb82176 in PCDM_ReadWriter::FileFormat(std::istream&, opencascade::handle<Storage_Data>&) /home/abv/occt/src/PCDM/PCDM_ReadWriter.cxx:171:12
    #4 0x7f515bb906e4 in CDF_Application::Read(std::istream&) /home/abv/occt/src/CDF/CDF_Application.cxx:334:15
    #5 0x7f515bf0fadb in TDocStd_Application::Open(std::istream&, opencascade::handle<TDocStd_Document>&) /home/abv/occt/src/TDocStd/TDocStd_Application.cxx:326:70
    #6 0x7f515da407bf in DDocStd_Open(Draw_Interpretor&, int, char const**) /home/abv/occt/src/DDocStd/DDocStd_ApplicationCommands.cxx:159:22
    0000007 0x7f5170405349 in Draw_Interpretor::CallBackDataFunc::Invoke(Draw_Interpretor&, int, char const**) /home/abv/occt/src/Draw/Draw_Interpretor.hxx:81:31
    0000008 0x7f5170412b7d in CommandCmd(void*, Tcl_Interp*, int, char const**) /home/abv/occt/src/Draw/Draw_Interpretor.cxx:154:40
    0000009 0x7f516a7a2b95 in TclInvokeStringCommand (/usr/lib/x86_64-linux-gnu/libtcl8.6.so+0x38b95)

SUMMARY: AddressSanitizer: memcpy-param-overlap (/home/abv/tmp/occt-clang/lin64/clang/bini/DRAWEXE-7.4.0+0x4dd619) in __asan_memcpy
==5864==ABORTING
Not possible
No tags attached.
child of 0030557new kgv Coding - eliminate errors reported by -fsanitize 
Issue History
2019-09-28 09:12abvNew Issue
2019-09-28 09:12abvAssigned To => mpv
2019-09-28 09:13abvRelationship addedchild of 0030557
2019-09-30 14:12gitNote Added: 0087636
2019-09-30 18:04mpvNote Added: 0087642
2019-09-30 18:04mpvAssigned Tompv => szy
2019-09-30 18:04mpvStatusnew => resolved
2019-09-30 18:04mpvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=21913#r21913
2019-09-30 18:06mpvNote Edited: 0087642bug_revision_view_page.php?bugnote_id=87642#r21915
2019-09-30 19:17gitNote Added: 0087643
2019-09-30 19:18abvNote Added: 0087644
2019-09-30 19:18abvAssigned Toszy => bugmaster
2019-09-30 19:18abvStatusresolved => reviewed
2019-10-23 01:07abvChangeset attached => occt master 3358ed64
2019-10-23 01:07abvAssigned Tobugmaster => abv
2019-10-23 01:07abvStatusreviewed => verified
2019-10-23 01:07abvResolutionopen => fixed
2019-10-23 11:51gitNote Added: 0088469
2019-10-23 17:01apnTest case number => Not needed
2020-12-02 16:40emoFixed in Version => 7.5.0
2020-12-02 17:12emoStatusverified => closed

Notes
(0087636)
git   
2019-09-30 14:12   
Branch CR31008 has been created by mpv.

SHA-1: b0fc8855cb847db4dc8a8b63928ffa77ac8d9983


Detailed log of new commits:

Author: mpv
Date: Mon Sep 30 14:12:35 2019 +0300

    31008: Application Framework - memcpy-param-overlap reported by Clang address sanitizer in LDOM_XmlReader::ReadRecord()
    
    Use memmove instead of memcpy because of copy of the possible overlapped source and destination parts of the buffer.
(0087642)
mpv   
2019-09-30 18:04   
(edited on: 2019-09-30 18:06)
Tests are ok:

http://occt-tests/CR31008-master-MPV-OCCT/Windows-64-VC14/diff_summary.html [^]
http://occt-tests/CR31008-master-MPV-OCCT/Debian80-64/diff_summary.html [^]

Please, review.

(0087643)
git   
2019-09-30 19:17   
Branch CR31008 has been updated forcibly by abv.

SHA-1: 18583a535dc32f15d05201e9ef8933ab2c69d431
(0087644)
abv   
2019-09-30 19:18   
Reviewed with minor amendments (stylistic), please integrate
(0088469)
git   
2019-10-23 11:51   
Branch CR31008 has been deleted by kgv.

SHA-1: 18583a535dc32f15d05201e9ef8933ab2c69d431