mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
Abort if BearSSL stack allocation fails (#7152)
As found by @d-a-v, if the malloc() used to get the BearSSL stack does not succeed, abort() immediately.
This commit is contained in:
parent
e252873263
commit
db75d2c448
@ -26,6 +26,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "pgmspace.h"
|
||||
#include "debug.h"
|
||||
#include "StackThunk.h"
|
||||
#include <ets_sys.h>
|
||||
|
||||
@ -46,6 +49,11 @@ void stack_thunk_add_ref()
|
||||
stack_thunk_refcnt++;
|
||||
if (stack_thunk_refcnt == 1) {
|
||||
stack_thunk_ptr = (uint32_t *)malloc(_stackSize * sizeof(uint32_t));
|
||||
if (!stack_thunk_ptr) {
|
||||
// This is a fatal error, stop the sketch
|
||||
DEBUGV("Unable to allocate BearSSL stack\n");
|
||||
abort();
|
||||
}
|
||||
stack_thunk_top = stack_thunk_ptr + _stackSize - 1;
|
||||
stack_thunk_save = NULL;
|
||||
stack_thunk_repaint();
|
||||
|
Loading…
x
Reference in New Issue
Block a user