Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6709 Discussions

Segmentation fault in ippiRotate with "nan" parameter

Hristov__Hristo
New Contributor I
294 Views
Is it normal for ippiRotate to cause segmentation fault when "nan" is passed as angle?
I believe it should return error and not segfault in any case...
Here is the code:
#include 
#include 
#include 

void test_ippiRotate_nan_segfault()
{
    int srcWidth = 100, srcHeight = 100, srcStep;
    Ipp8u *pSrc = ippiMalloc_8u_C1(srcWidth, srcHeight, &srcStep);
    IppiSize srcSize = { srcWidth, srcHeight };
    IppiRect srcRoi = { 0, 0, srcWidth, srcHeight };

    int dstWidth = 100, dstHeight = 100, dstStep;
    Ipp8u *pDst = ippiMalloc_8u_C1(dstWidth, dstHeight, &dstStep);
    IppiRect dstRoi = { 0, 0, dstWidth, dstHeight };

    double a = std::numeric_limits<double>::quiet_NaN();
    double sx = 0, sy = 0;

    printf("call: ippiRotate_8u_C1R(... , %f %f %f) ...\\n", a, sx, sy);
    ippiRotate_8u_C1R(pSrc, srcSize, srcStep, srcRoi, pDst, dstStep, dstRoi, a, sx, sy, IPPI_INTER_LINEAR);
    printf("done: ippiRotate_8u_C1R() ...\\n");

    ippiFree(pSrc);
    ippiFree(pDst);
}

output:
call: ippiRotate_8u_C1R(... , nan 0.000000 0.000000) ...
Segmentation fault (core dumped)
backtrace:
Program terminated with signal 11, Segmentation fault.
#0 0x00007fa823d52d86 in y8_ownpi_WarpAffine_L_8u_C1 () from /opt/intel/composerxe/ipp/lib/intel64/libippiy8.so.7.0
#1 0x00007fa82393862e in y8_ownpi_WarpAffine () from /opt/intel/composerxe/ipp/lib/intel64/libippiy8.so.7.0
#2 0x00007fa8235371ef in y8_ownpi_Rotate () from /opt/intel/composerxe/ipp/lib/intel64/libippiy8.so.7.0
#3 0x00007fa82346d1ea in y8_ippiRotate_8u_C1R () from /opt/intel/composerxe/ipp/lib/intel64/libippiy8.so.7.0
0 Kudos
2 Replies
Chuck_De_Sylva
Beginner
294 Views
Hristo,

In order to have secure behavior a check on NaN and +-INF will be added to the next version of IPP (7.1 Gold). The implementation is currently underway.

Thanks,
Chuck
0 Kudos
Hristov__Hristo
New Contributor I
294 Views
What is planned for functions for which params are arrays or masks of doubles (for example ippiRemap() crashes in the same way if there is NaN in the map)?
Do we have to check for Nan/Inf before each IPP call with floating point params in order to prevent segmentation faults?
Thanks!
0 Kudos
Reply