View Issue Details

IDProjectCategoryView StatusLast Update
0031008Open CASCADEOCCT:Application Frameworkpublic2020-12-02 17:12
ReporterabvAssigned Toabv 
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Target Version7.5.0Fixed in Version7.5.0 
Summary0031008: Application Framework - memcpy-param-overlap reported by Clang address sanitizer in LDOM_XmlReader::ReadRecord()
DescriptionWhen 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
Steps To ReproduceNot possible
TagsNo tags attached.
Test case numberNot needed

Relationships

child of 0030557 newvpozdyayev Coding - eliminate errors reported by -fsanitize 

Activities

git

2019-09-30 14:12

administrator   ~0087636

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.

mpv

2019-09-30 18:04

developer   ~0087642

Last edited: 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.

git

2019-09-30 19:17

administrator   ~0087643

Branch CR31008 has been updated forcibly by abv.

SHA-1: 18583a535dc32f15d05201e9ef8933ab2c69d431

abv

2019-09-30 19:18

manager   ~0087644

Reviewed with minor amendments (stylistic), please integrate

git

2019-10-23 11:51

administrator   ~0088469

Branch CR31008 has been deleted by kgv.

SHA-1: 18583a535dc32f15d05201e9ef8933ab2c69d431

Related Changesets

occt: master 3358ed64

2019-09-30 11:12:35

abv


Committer: abv Details Diff
0031008: 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.
Affected Issues
0031008
mod - src/LDOM/LDOM_XmlReader.cxx Diff File

Issue History

Date Modified Username Field Change
2019-09-28 09:12 abv New Issue
2019-09-28 09:12 abv Assigned To => mpv
2019-09-28 09:13 abv Relationship added child of 0030557
2019-09-30 14:12 git Note Added: 0087636
2019-09-30 18:04 mpv Note Added: 0087642
2019-09-30 18:04 mpv Assigned To mpv => szy
2019-09-30 18:04 mpv Status new => resolved
2019-09-30 18:04 mpv Steps to Reproduce Updated
2019-09-30 18:06 mpv Note Edited: 0087642
2019-09-30 19:17 git Note Added: 0087643
2019-09-30 19:18 abv Note Added: 0087644
2019-09-30 19:18 abv Assigned To szy => bugmaster
2019-09-30 19:18 abv Status resolved => reviewed
2019-10-23 01:07 abv Changeset attached => occt master 3358ed64
2019-10-23 01:07 abv Assigned To bugmaster => abv
2019-10-23 01:07 abv Status reviewed => verified
2019-10-23 01:07 abv Resolution open => fixed
2019-10-23 11:51 git Note Added: 0088469
2019-10-23 17:01 apn Test case number => Not needed
2020-12-02 16:40 emo Fixed in Version => 7.5.0
2020-12-02 17:12 emo Status verified => closed