Skip to content

Commit 94ec997

Browse files
committed
[OpenMP][OMPT] Add two missing nullpointer checks in ompt-multiplex.h
In the functions ompt_multiplex_get_own_ompt_data and ompt_multiplex_get_client_ompt_data in addition to data being NULL, also the void pointer field "ptr" of "data" could be NULL, leading to a subsequent segfault. This patch add the corresponding checks. Patch prepared by Semih Burak Differential Revision: https://reviews.llvm.org/D112806
1 parent 36f6743 commit 94ec997

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

openmp/tools/multiplex/ompt-multiplex.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ static void ompt_multiplex_free_data_pair(ompt_data_t *data_pointer) {
142142
static ompt_data_t *ompt_multiplex_get_own_ompt_data(ompt_data_t *data) {
143143
if (!data)
144144
return NULL;
145+
if (!data->ptr)
146+
return NULL;
145147
ompt_multiplex_data_pair_t *data_pair =
146148
(ompt_multiplex_data_pair_t *)data->ptr;
147149
return &(data_pair->own_data);
@@ -150,6 +152,8 @@ static ompt_data_t *ompt_multiplex_get_own_ompt_data(ompt_data_t *data) {
150152
static ompt_data_t *ompt_multiplex_get_client_ompt_data(ompt_data_t *data) {
151153
if (!data)
152154
return NULL;
155+
if (!data->ptr)
156+
return NULL;
153157
ompt_multiplex_data_pair_t *data_pair =
154158
(ompt_multiplex_data_pair_t *)data->ptr;
155159
return &(data_pair->client_data);

0 commit comments

Comments
 (0)