Skip to content

Commit a39a051

Browse files
authored
Merge pull request #9213 from rhc54/rfc41/pmix3
v4.1.x: Protect the pmix3x component from a PMIx v4 attribute
2 parents 0330502 + bd48a06 commit a39a051

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

opal/mca/pmix/pmix3x/pmix3x.c

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Copyright (c) 2016 Cisco Systems, Inc. All rights reserved.
99
* Copyright (c) 2017 Los Alamos National Security, LLC. All rights
1010
* reserved.
11+
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
1112
* $COPYRIGHT$
1213
*
1314
* Additional copyrights may follow
@@ -966,6 +967,7 @@ int pmix3x_value_unload(opal_value_t *kv,
966967
opal_list_t *lt;
967968
opal_value_t *ival;
968969
size_t n;
970+
pmix_info_t *iptr;
969971

970972
switch(v->type) {
971973
case PMIX_UNDEF:
@@ -1178,27 +1180,30 @@ int pmix3x_value_unload(opal_value_t *kv,
11781180
kv->data.pinfo.state = pmix3x_convert_state(v->data.pinfo->state);
11791181
break;
11801182
case PMIX_DATA_ARRAY:
1181-
if (NULL == v->data.darray || NULL == v->data.darray->array) {
1183+
if (NULL == v->data.darray || NULL == v->data.darray->array ||
1184+
PMIX_INFO != v->data.darray->type) {
11821185
kv->data.ptr = NULL;
11831186
break;
11841187
}
11851188
lt = OBJ_NEW(opal_list_t);
11861189
kv->type = OPAL_PTR;
11871190
kv->data.ptr = (void*)lt;
1191+
iptr = (pmix_info_t*)v->data.darray->array;
11881192
for (n=0; n < v->data.darray->size; n++) {
1193+
if (0 == strcmp("pmix.topo2", iptr[n].key)) {
1194+
/* we do not know (yet) how to convert the pmix.topo2 key from PMIx 4.0.0
1195+
* but since we are not going to use it, simply ignore it and move on */
1196+
continue;
1197+
}
11891198
ival = OBJ_NEW(opal_value_t);
11901199
opal_list_append(lt, &ival->super);
1191-
/* handle the various types */
1192-
if (PMIX_INFO == v->data.darray->type) {
1193-
pmix_info_t *iptr = (pmix_info_t*)v->data.darray->array;
1194-
ival->key = strdup(iptr[n].key);
1195-
rc = pmix3x_value_unload(ival, &iptr[n].value);
1196-
if (OPAL_SUCCESS != rc) {
1197-
OPAL_LIST_RELEASE(lt);
1198-
kv->type = OPAL_UNDEF;
1199-
kv->data.ptr = NULL;
1200-
break;
1201-
}
1200+
ival->key = strdup(iptr[n].key);
1201+
rc = pmix3x_value_unload(ival, &iptr[n].value);
1202+
if (OPAL_SUCCESS != rc) {
1203+
OPAL_LIST_RELEASE(lt);
1204+
kv->type = OPAL_UNDEF;
1205+
kv->data.ptr = NULL;
1206+
break;
12021207
}
12031208
}
12041209
break;

0 commit comments

Comments
 (0)