Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Safety: CecConnection::transmit can crash with full packet size #22

Open
ssalonen opened this issue Feb 24, 2022 · 2 comments
Open

Safety: CecConnection::transmit can crash with full packet size #22

ssalonen opened this issue Feb 24, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@ssalonen
Copy link
Owner

ssalonen commented Feb 24, 2022

Bug description

CecConnection::transmit will fail with libcec version x (TODO) when trying to transmit command having data packet of maximum size

The crash occurs in raspberry pi libcec adapter code.

https://github.com/Pulse-Eight/libcec/blob/master/src/libcec/adapter/RPi/RPiCECAdapterMessageQueue.cpp

Possible failure reason (not verified):

cec_adapter_message_state CRPiCECAdapterMessageQueue::Write(const cec_command &command, bool &bRetry, uint32_t iLineTimeout, bool bIsReply, VC_CEC_ERROR_T &vcReply)
<SNIP>

#if defined(RPI_USE_SEND_MESSAGE2)
<SNIP>
#else
<SNIP>
 uint8_t payload[32];
<SNIP>
    for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++)
      payload[iPtr + 1] = command.parameters.At(iPtr);
  }
<SNIP>


#fi

However, command.parameters can be up to 64 uint8_t cectypes.h --> payload local variable is not large enough!

To Reproduce

TODO

Expected behavior

Screenshots

Environment

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context

@ssalonen ssalonen added the bug Something isn't working label Feb 24, 2022
@ssalonen
Copy link
Owner Author

Discussion on max payload size in the context of Pulse8 adapter Pulse-Eight/libcec#443

@ssalonen
Copy link
Owner Author

ssalonen commented May 7, 2022

Upstream issue created Pulse-Eight/libcec#602

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant