Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdb75d2c

Browse files
Abort if BearSSL stack allocation fails (#7152)
As found by@d-a-v, if the malloc() used to get the BearSSL stack doesnot succeed, abort() immediately.
1 parente252873 commitdb75d2c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎cores/esp8266/StackThunk.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
#include<stdint.h>
2828
#include<stdlib.h>
29+
#include<stdio.h>
30+
#include"pgmspace.h"
31+
#include"debug.h"
2932
#include"StackThunk.h"
3033
#include<ets_sys.h>
3134

@@ -46,6 +49,11 @@ void stack_thunk_add_ref()
4649
stack_thunk_refcnt++;
4750
if (stack_thunk_refcnt ==1) {
4851
stack_thunk_ptr = (uint32_t *)malloc(_stackSize *sizeof(uint32_t));
52+
if (!stack_thunk_ptr) {
53+
// This is a fatal error, stop the sketch
54+
DEBUGV("Unable to allocate BearSSL stack\n");
55+
abort();
56+
}
4957
stack_thunk_top = stack_thunk_ptr + _stackSize -1;
5058
stack_thunk_save =NULL;
5159
stack_thunk_repaint();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp