This looks like something the user-code can call. Should be a VERIFY instead of an ASSERT. Ideally the array access should be guarded as well. if (index < size) { ... }