libcds icon indicating copy to clipboard operation
libcds copied to clipboard

Invalid random level in skip list with custom random level generator (the one than can return more than c_nMaxHeight)

Open kazachkovaanna opened this issue 6 years ago • 0 comments

https://github.com/khizmax/libcds/blob/44c052bdb69aaf26d7010074547356c80e55421a/cds/intrusive/impl/skip_list.h#L1101-L1106

https://github.com/khizmax/libcds/blob/44c052bdb69aaf26d7010074547356c80e55421a/cds/intrusive/impl/skip_list.h#L359-L363

Inside conditional minimum value is choosen, and in random_level max is bounded with 32. But, array index will be initialized with greater number from conditional. So it is possible to have array of 32 elements and index 99. Possible resolution is to add assert or use min value from conditional for index

kazachkovaanna avatar Feb 04 '19 17:02 kazachkovaanna