Skip to content

Commit 9d7a436

Browse files
fix: add null pointer check for fopen call in ggml.c
- Add null check for fopen call in ggml_print_backtrace function - Prevents null pointer dereference vulnerability Addresses 2 null pointer dereference vulnerabilities (CWE-476) Co-Authored-By: Jake Cosme <[email protected]>
1 parent 0c5b4fb commit 9d7a436

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ggml/src/ggml.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ void ggml_print_backtrace(void) {
137137
}
138138
#if defined(__linux__)
139139
FILE * f = fopen("/proc/self/status", "r");
140+
if (f == NULL) {
141+
return;
142+
}
140143
size_t size = 0;
141144
char * line = NULL;
142145
ssize_t length = 0;

0 commit comments

Comments
 (0)