opal/dss_unpack: correctly handle some bozo cases
as reported by Coverity with CIDs 1269987 and 1269988
Этот коммит содержится в:
родитель
4c0eb11e08
Коммит
307a33991c
@ -11,7 +11,7 @@
|
|||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
* Copyright (c) 2012 Los Alamos National Security, Inc. All rights reserved.
|
||||||
* Copyright (c) 2014 Intel, Inc. All rights reserved.
|
* Copyright (c) 2014 Intel, Inc. All rights reserved.
|
||||||
* Copyright (c) 2014 Research Organization for Information Science
|
* Copyright (c) 2014-2015 Research Organization for Information Science
|
||||||
* and Technology (RIST). All rights reserved.
|
* and Technology (RIST). All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
@ -424,6 +424,9 @@ int opal_dss_unpack_float(opal_buffer_t *buffer, void *dest,
|
|||||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_string(buffer, &convert, &n, OPAL_STRING))) {
|
if (OPAL_SUCCESS != (ret = opal_dss_unpack_string(buffer, &convert, &n, OPAL_STRING))) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
if (NULL == convert) {
|
||||||
|
return OPAL_ERR_UNPACK_FAILURE;
|
||||||
|
}
|
||||||
tmp = strtof(convert, NULL);
|
tmp = strtof(convert, NULL);
|
||||||
memcpy(&desttmp[i], &tmp, sizeof(tmp));
|
memcpy(&desttmp[i], &tmp, sizeof(tmp));
|
||||||
free(convert);
|
free(convert);
|
||||||
@ -451,6 +454,9 @@ int opal_dss_unpack_double(opal_buffer_t *buffer, void *dest,
|
|||||||
if (OPAL_SUCCESS != (ret = opal_dss_unpack_string(buffer, &convert, &n, OPAL_STRING))) {
|
if (OPAL_SUCCESS != (ret = opal_dss_unpack_string(buffer, &convert, &n, OPAL_STRING))) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
if (NULL == convert) {
|
||||||
|
return OPAL_ERR_UNPACK_FAILURE;
|
||||||
|
}
|
||||||
tmp = strtod(convert, NULL);
|
tmp = strtod(convert, NULL);
|
||||||
memcpy(&desttmp[i], &tmp, sizeof(tmp));
|
memcpy(&desttmp[i], &tmp, sizeof(tmp));
|
||||||
free(convert);
|
free(convert);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user