@@ -353,6 +353,21 @@ DEFINE_TEST(random_doublecheck_test) {
353353 }
354354}
355355
356+ #if ROARING_EXCEPTIONS
357+ // credit: Oleg Lazari
358+ DEFINE_TEST (safe_test_lazari) {
359+ unsigned char payload[] = {0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
360+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x3b , 0x30 ,
361+ 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
362+ 0x00 , 0x6a , 0x6a , 0xd4 };
363+ try {
364+ roaring::Roaring64Map::readSafe ((const char *)payload, sizeof (payload));
365+ assert_false (true ); // it should not reach here
366+ } catch (...) {
367+ }
368+ }
369+ #endif
370+
356371DEFINE_TEST (random_doublecheck_test_64) {
357372 //
358373 // Make a group of bitsets to choose from when performing operations.
@@ -487,6 +502,9 @@ int main() {
487502 gravity64 = (static_cast <uint64_t >(rand ()) << 32 ) + rand () % 20000 - 10000 ;
488503
489504 const struct CMUnitTest tests[] = {
505+ #if ROARING_EXCEPTIONS
506+ cmocka_unit_test (safe_test_lazari),
507+ #endif
490508 cmocka_unit_test (sanity_check_doublechecking),
491509 cmocka_unit_test (sanity_check_doublechecking_64),
492510 cmocka_unit_test (random_doublecheck_test),
0 commit comments