string.c (mrb_str_len_to_dbl): should return zero for invalid string

We should not use uninitialized value; fix #6183
This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-02-24 23:03:15 +09:00
parent 6248e9c2ef
commit 8130bbc479
+1 -1
View File
@@ -2734,7 +2734,7 @@ bad:
mrb_raisef(mrb, E_ARGUMENT_ERROR, "invalid string for float(%!s)", s);
/* not reached */
}
return d;
return 0.0;
}
if (badcheck) {
if (!end || p == end) goto bad;