intel / ipp-crypto

Apache License 2.0
314 stars 85 forks source link

Undefined behavior issue in cpGetBitSize() #55

Closed xhuan28 closed 1 year ago

xhuan28 commented 1 year ago

In pcpmont_set.c ,

__INLINE int cpGetBitSize(Ipp32u offset, Ipp32u val)  
{  
    int bitSize = 32;  
    if (val == 0) return 0;  
    while ((val & (1 << bitSize)) == 0) bitSize--;  
    return (int)offset + bitSize;  
}

1 << 32 may lead to an undefined behavior issue.

xhuan28 commented 1 year ago

https://github.com/intel/ipp-crypto/pull/56 may fix this issue.