Skip to content

Commit 67166f8

Browse files
committed
RPC: fix msgpack parser going OOM
1 parent 838d644 commit 67166f8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

libraries/RPC/src/RPC.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ int RPCClass::begin(long unsigned int np, uint16_t nd) {
149149
// Ideally this should execute only once
150150
disableCM4Autoboot();
151151

152-
eventThread = new rtos::Thread(osPriorityHigh, 4096);
153-
eventThread->start(&eventHandler);
152+
eventThread = new rtos::Thread(osPriorityHigh, 4096, nullptr, "rpc_evt");
153+
eventThread->start(&eventHandler);
154154

155-
dispatcherThread = new rtos::Thread(osPriorityNormal, 4096);
155+
dispatcherThread = new rtos::Thread(osPriorityNormal, 4096, nullptr, "rpc_dispatch");
156156
dispatcherThread->start(mbed::callback(this, &RPCClass::dispatch));
157157

158-
responseThread = new rtos::Thread(osPriorityNormal, 4096);
158+
responseThread = new rtos::Thread(osPriorityNormal, 4096, nullptr, "rpc_response");
159159
responseThread->start(mbed::callback(this, &RPCClass::response));
160160

161161
/* Initialize OpenAmp and libmetal libraries */
@@ -196,13 +196,13 @@ int RPCClass::begin(long unsigned int np, uint16_t nd) {
196196

197197
int RPCClass::begin(long unsigned int np, uint16_t nd) {
198198

199-
eventThread = new rtos::Thread(osPriorityHigh, 4096);
199+
eventThread = new rtos::Thread(osPriorityHigh, 4096, nullptr, "rpc_evt");
200200
eventThread->start(&eventHandler);
201201

202-
dispatcherThread = new rtos::Thread(osPriorityNormal, 4096);
202+
dispatcherThread = new rtos::Thread(osPriorityNormal, 4096, nullptr, "rpc_dispatch");
203203
dispatcherThread->start(mbed::callback(this, &RPCClass::dispatch));
204204

205-
responseThread = new rtos::Thread(osPriorityNormal, 4096);
205+
responseThread = new rtos::Thread(osPriorityNormal, 4096, nullptr, "rpc_response");
206206
responseThread->start(mbed::callback(this, &RPCClass::response));
207207

208208
/* Initialize OpenAmp and libmetal libraries */
@@ -244,6 +244,7 @@ void RPCClass::response() {
244244
osSignalWait(0, osWaitForever);
245245

246246
{
247+
247248
RPCLIB_MSGPACK::unpacker pac;
248249

249250
rx_mtx.lock();

libraries/rpclib/src/rpc/msgpack/unpack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ typedef struct msgpack_unpacker {
6666

6767

6868
#ifndef MSGPACK_UNPACKER_INIT_BUFFER_SIZE
69-
#define MSGPACK_UNPACKER_INIT_BUFFER_SIZE (64*1024)
69+
#define MSGPACK_UNPACKER_INIT_BUFFER_SIZE (1024)
7070
#endif
7171

7272
/**

0 commit comments

Comments
 (0)