Assert on overflow in str_concat
This commit is contained in:
+1
-1
@@ -19,7 +19,7 @@ Str str_slice(Str str, U32 start, U32 len)
|
|||||||
Str str_concat(Allocator *alloc, Str first, Str second)
|
Str str_concat(Allocator *alloc, Str first, Str second)
|
||||||
{
|
{
|
||||||
Str str;
|
Str str;
|
||||||
|
Assert(first.len <= U32_Max - second.len);
|
||||||
str.len = first.len + second.len;
|
str.len = first.len + second.len;
|
||||||
str.str = allocator_push(alloc, str.len, 1);;
|
str.str = allocator_push(alloc, str.len, 1);;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user