Blosc / c-blosc2

A fast, compressed, persistent binary data store library for C.

Home Page:https://www.blosc.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

blosc_getitem return value seems inconsistent (DeepState fuzzing)

agroce opened this issue · comments

Whether I assert that it is the #bytes of the #items, some tests seem to violate the claim. Is this known/expected?

	      unsigned start_item = DeepState_UIntInRange(0, num_elements-1);
	      unsigned num_items = DeepState_UIntInRange(0, num_elements-start_item);
	      LOG(TRACE) << "Getting " << num_items << " from " << start_item;
	      int get_result = blosc_getitem(intermediate, start_item, num_items, items);
	      //ASSERT_EQ(get_result, num_items * type_size) <<
	      //"Getting " << num_items << " from " << start_item << " expected: " << num_items * type_size << ": got " << get_result;

If I allow either:

             ASSERT((get_result == num_items) || (get_result == (num_items * type_size))) <<
                "Getting " << num_items << " from " << start_item << " with size " << type_size << ": got " << get_result;

it never fails, but that's not a consistent API. I can minimize a failing example, if you can clarify which is the expected return value.

Looks like this is also due to type_size limit being 255; maybe should fail if parameter is too big?

Ditto in #92. But I see your point, by silently reducing typesize to 1 we are creating inconsistencies in the API. Hmm, probably failing would be better than just documenting this; I need to think a bit more on this. Anyway, thanks for bringing this to our attention.