Skip to content

Commit 095bbd5

Browse files
Copilotsyoyo
andcommitted
Simplify TypedArray overflow guard: remove unnecessary sizeof(T) > 1 condition
Co-authored-by: syoyo <18676+syoyo@users.noreply.github.com>
1 parent 44b6270 commit 095bbd5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tiny_obj_loader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ class TypedArray {
10341034
return;
10351035
}
10361036
// Guard against size_t overflow in count * sizeof(T).
1037-
if (sizeof(T) > 1 && count > SIZE_MAX / sizeof(T)) {
1037+
if (count > SIZE_MAX / sizeof(T)) {
10381038
throw std::bad_alloc();
10391039
}
10401040
void *p = arena.allocate(count * sizeof(T), alignof(T));

0 commit comments

Comments
 (0)