ObjFW  Check-in [e68229ff3b]

Overview
Comment:Add a missing check in OFDataArray.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e68229ff3bab9c386c62e073173d311d848aec85acb9a707f2348b49cde63d9e
User & Date: js on 2012-06-06 12:23:23
Other Links: manifest | tags
Context
2012-06-06
13:09
Rework OFDataArray API. check-in: d5ddb2cb48 user: js tags: trunk
12:23
Add a missing check in OFDataArray. check-in: e68229ff3b user: js tags: trunk
12:15
-[addObject:atIndex:] -> -[insertObject:atIndex:]. check-in: 26f2ffa908 user: js tags: trunk
Changes

Modified src/OFDataArray.m from [f620eb9fde] to [d431a67a01].

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
	count += nItems;
}

- (void)addNItems: (size_t)nItems
       fromCArray: (const void*)cArray
	  atIndex: (size_t)index
{
	if (nItems > SIZE_MAX - count)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	data = [self resizeMemory: data
			 toNItems: count + nItems
			   ofSize: itemSize];

	memmove(data + (index + nItems) * itemSize, data + index * itemSize,







|







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
	count += nItems;
}

- (void)addNItems: (size_t)nItems
       fromCArray: (const void*)cArray
	  atIndex: (size_t)index
{
	if (nItems > SIZE_MAX - count || index > count)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	data = [self resizeMemory: data
			 toNItems: count + nItems
			   ofSize: itemSize];

	memmove(data + (index + nItems) * itemSize, data + index * itemSize,