You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] BasicCodecFactory::create() and dispose() have no mutex — TOCTOU race on static codec pool #476
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
}
Activity
github-actions commentedon Apr 22, 2026
Hi eRPC user. Thank you for your interest and welcome. We hope you will enjoy this framework well.