- eRPC version: latest (2026)
- Allocation policy: ERPC_ALLOCATION_POLICY_STATIC
- Threading model: ERPC_THREADS_CMSIS
- Platform: ARM Cortex-M
Bug description
BasicCodecFactory::create() and dispose() perform an unprotected read-modify-write on the shared static array s_basicCodecManual. When two RTOS threads call create() simultaneously, both can observe the same slot as !isUsed() and both call construct() on it — corrupting the pool.
// erpc_basic_codec.cpp
Codec *BasicCodecFactory::create(void)
{
ERPC_CREATE_NEW_OBJECT(BasicCodec, s_basicCodecManual, ERPC_CODEC_COUNT)
// expands to: scan array, construct first free slot, return pointer
// — no lock taken anywhere
}
void BasicCodecFactory::dispose(Codec *codec)
{
ERPC_DESTROY_OBJECT(codec, s_basicCodecManual, ERPC_CODEC_COUNT)
// expands to: scan array, destroy matching slot
// — no lock taken anywhere
}
Steps to reproduce the behavior:
- Configure ERPC_ALLOCATION_POLICY_STATIC, ERPC_THREADS_CMSIS
- Start 2 or more SimpleServer instances in separate RTOS threads
- Run concurrent client calls from 2+ client threads for several hours
- Observe erpc_assert in StaticMessageBufferFactory::create() or NULL dereference in ClientManager::createBufferAndCodec()
- OS: embos
- eRPC Version: v1.14.0
Bug description
BasicCodecFactory::create()anddispose()perform an unprotected read-modify-write on the shared static arrays_basicCodecManual. When two RTOS threads callcreate()simultaneously, both can observe the same slot as!isUsed()and both callconstruct()on it — corrupting the pool.Steps to reproduce the behavior: