Updates will be applied on October 27th between 12pm - 12:45pm EDT (UTC-0400). Gitlab may be slow during the maintenance window.

Commit 991a64b5 authored by Kenneth Moreland's avatar Kenneth Moreland
Browse files

Add checks for null sparse image now that it is allowed.

parent 0ce182ec
......@@ -52,10 +52,12 @@ static void ICET_TEST_IMAGE_HEADER(IceTImage image)
}
static void ICET_TEST_SPARSE_IMAGE_HEADER(IceTSparseImage image)
{
if ( ICET_IMAGE_HEADER(image)[ICET_IMAGE_MAGIC_NUM_INDEX]
!= ICET_SPARSE_IMAGE_MAGIC_NUM ) {
icetRaiseError("Detected invalid image header.",
ICET_SANITY_CHECK_FAIL);
if (!icetSparseImageIsNull(image)) {
if ( ICET_IMAGE_HEADER(image)[ICET_IMAGE_MAGIC_NUM_INDEX]
!= ICET_SPARSE_IMAGE_MAGIC_NUM ) {
icetRaiseError("Detected invalid image header.",
ICET_SANITY_CHECK_FAIL);
}
}
}
#else /*DEBUG*/
......@@ -1082,6 +1084,16 @@ void icetSparseImagePackageForSend(IceTSparseImage image,
{
ICET_TEST_SPARSE_IMAGE_HEADER(image);
if (icetSparseImageIsNull(image)) {
/* Should we return a Null pointer and 0 size without error?
Would all versions of MPI accept that? */
icetRaiseError("Cannot package NULL image for send.",
ICET_INVALID_VALUE);
*buffer = NULL;
*size = 0;
return;
}
*buffer = image.opaque_internals;
*size = ICET_IMAGE_HEADER(image)[ICET_IMAGE_ACTUAL_BUFFER_SIZE_INDEX];
}
......@@ -1501,6 +1513,8 @@ void icetClearSparseImage(IceTSparseImage image)
ICET_TEST_SPARSE_IMAGE_HEADER(image);
if (icetSparseImageIsNull(image)) { return; }
/* Use IceTByte for byte-based pointer arithmetic. */
data = ICET_IMAGE_DATA(image);
p = icetSparseImageGetNumPixels(image);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment