Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -68,11 +68,11 @@ return data + (items - 1) * itemsize; } - add: (void*)item { - if (SIZE_MAX - items < 1) + if (SIZE_MAX - items < 1 || items + 1 > SIZE_MAX / itemsize) @throw [OFOutOfRangeException newWithClass: [self class]]; data = [self resizeMem: data toNItems: items + 1 ofSize: itemsize]; @@ -83,11 +83,11 @@ } - addNItems: (size_t)nitems fromCArray: (void*)carray { - if (nitems > SIZE_MAX - items) + if (nitems > SIZE_MAX - items || items + nitems > SIZE_MAX / itemsize) @throw [OFOutOfRangeException newWithClass: [self class]]; data = [self resizeMem: data toNItems: items + nitems ofSize: itemsize];