mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mrb_str_cat: capa should not be zero to avoid infinite loops.
This commit is contained in:
@@ -2566,6 +2566,7 @@ mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len)
|
||||
mrb_raise(mrb, E_ARGUMENT_ERROR, "string size too big");
|
||||
}
|
||||
if (capa <= total) {
|
||||
if (capa == 0) capa = 1;
|
||||
while (capa <= total) {
|
||||
if (capa <= MRB_INT_MAX / 2) {
|
||||
capa *= 2;
|
||||
|
||||
Reference in New Issue
Block a user