Skip to content

CCECClient::SetConfiguration(): Source and destination overlap in memcpy #703

@fwolter

Description

@fwolter

There's a valgrind error when the source and destination config are the same:

==46723== Source and destination overlap in memcpy(0x1e1425de, 0x1e1425de, 3)
==46723==    at 0x488CFA0: __GI_memcpy (vg_replace_strmem.c:1121)
==46723==    by 0x1F698793: CEC::CCECClient::SetConfiguration(CEC::libcec_configuration const&) (CECClient.cpp:919)
==46723==    by 0x1F6A406B: CEC::CCECProcessor::RegisterClient(std::shared_ptr<CEC::CCECClient>) (CECProcessor.cpp:913)
==46723==    by 0x1F6ABEC3: CEC::CLibCEC::Open(char const*, unsigned int) (LibCEC.cpp:91)
==46723==    by 0x1DD3C267: cecplugin::cCECRemote::Connect() (cecremote.cc:558)
==46723==    by 0x1DD3B19F: cecplugin::cCECRemote::Action() (cecremote.cc:268)
==46723==    by 0x2DE67B: cThread::StartThread(cThread*) (thread.c:294)
==46723==    by 0x4F4202F: start_thread (pthread_create.c:442)
==46723==    by 0x4FABF5B: thread_start (clone.S:79)

EDIT: This is triggered, when just running cec-client:

# valgrind cec-client
==49767== Memcheck, a memory error detector
==49767== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==49767== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==49767== Command: cec-client
==49767==
No device type given. Using 'recording device'
CEC Parser created - libCEC version 7.1.1
no serial port given. trying autodetect:
 path:     /dev/cec0
 com port: Linux

opening a connection to the CEC adapter...
DEBUG:   [             317]     Broadcast (F): osd name set to 'Broadcast'
DEBUG:   [             332]     CLinuxCECAdapterCommunication::Open - m_fd=3 bStartListening=1
DEBUG:   [             333]     CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_G_PHYS_ADDR - addr=2500
DEBUG:   [             336]     CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=0000 num_log_addrs=0
DEBUG:   [             337]     CLinuxCECAdapterCommunication::Open - ioctl CEC_ADAP_S_LOG_ADDRS - log_addr_mask=8000 num_log_addrs=1
DEBUG:   [             374]     CLinuxCECAdapterCommunication::Process - CEC_DQEVENT - CEC_EVENT_STATE_CHANGE - log_addr_mask=8000 phys_addr=2500
NOTICE:  [             375]     connection opened
DEBUG:   [             407]     processor thread started
DEBUG:   [             443]     << Broadcast (F) -> TV (0): POLL
TRAFFIC: [             447]     << f0
DEBUG:   [             656]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=1 addr=f0 opcode=ffffffff
DEBUG:   [             657]     >> POLL sent
DEBUG:   [             658]     TV (0): device status changed into 'present'
DEBUG:   [             659]     << requesting vendor ID of 'TV' (0)
TRAFFIC: [             661]     << f0:8c
DEBUG:   [             723]     CLinuxCECAdapterCommunication::Write - ioctl CEC_TRANSMIT - tx_status=01 len=2 addr=f0 opcode=8c
DEBUG:   [             860]     CLinuxCECAdapterCommunication::Process - ioctl CEC_RECEIVE - rx_status=01 len=5 addr=0f opcode=87
TRAFFIC: [             869]     >> 0f:87:00:00:f0
DEBUG:   [             873]     >> TV (0) -> Broadcast (F): device vendor id (87)
DEBUG:   [             878]     TV (0): vendor = Samsung (0000f0)
DEBUG:   [             887]     expected response received (87: device vendor id)
DEBUG:   [             888]     replacing the command handler for device 'TV' (0)
DEBUG:   [             891]     registering new CEC client - v7.1.1
==49767== Source and destination overlap in memcpy(0x4d9194e, 0x4d9194e, 3)
==49767==    at 0x488CFA0: __GI_memcpy (vg_replace_strmem.c:1121)
==49767==    by 0x51F86D3: CEC::CCECClient::SetConfiguration(CEC::libcec_configuration const&) (CECClient.cpp:919)
==49767==    by 0x5203FAB: CEC::CCECProcessor::RegisterClient(std::shared_ptr<CEC::CCECClient>) (CECProcessor.cpp:913)
==49767==    by 0x520BE03: CEC::CLibCEC::Open(char const*, unsigned int) (LibCEC.cpp:91)
==49767==    by 0x129D2F: main (cec-client.cpp:1413)
==49767==
DEBUG:   [             895]     using auto-detected physical address 2500
DEBUG:   [             903]     detecting logical address for type 'recording device'
DEBUG:   [             904]     trying logical address 'Recorder 1'
DEBUG:   [             904]     << Recorder 1 (1) -> Recorder 1 (1): POLL
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions