-
Notifications
You must be signed in to change notification settings - Fork 244
Closed
Milestone
Description
When transferring an empty list, the codec will be confused and all following structs are corrupted.
IDL:
interface Test {
getData(out list<uint8>) -> void
}
The client shim code looks like this:
static void read_list_uint8_1_t_struct(erpc::Codec * codec, list_uint8_1_t * data) {
codec->startReadList(&data->elementsCount);
data->elements = (uint8_t *) erpc_malloc(data->elementsCount * sizeof(uint8_t));
if (data->elements == NULL)
{
codec->updateStatus(kErpcStatus_MemoryError);
}
[...]
Depending on the implementation of erpc_malloc
the function may return NULL
if the size to malloc is zero.
In the NULL
case, which is our case is not an error the codec updates its state to error and all following struct are corrupted then.