From 69f9992ed41920389d4185141a14f02f89a4d306 Mon Sep 17 00:00:00 2001 From: usa Date: Tue, 12 Apr 2022 11:49:45 +0000 Subject: Fix dtoa buffer overrun git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util.c') diff --git a/util.c b/util.c index 7c83b50b8b..814404fdf1 100644 --- a/util.c +++ b/util.c @@ -2081,6 +2081,7 @@ break2: if (!*++s || !(s1 = strchr(hexdigit, *s))) goto ret0; if (*s == '0') { while (*++s == '0'); + if (!*s) goto ret; s1 = strchr(hexdigit, *s); } if (s1 != NULL) { @@ -2103,7 +2104,7 @@ break2: for (; *s && (s1 = strchr(hexdigit, *s)); ++s) { adj += aadj * ((s1 - hexdigit) & 15); if ((aadj /= 16) == 0.0) { - while (strchr(hexdigit, *++s)); + while (*++s && strchr(hexdigit, *s)); break; } } -- cgit v1.2.1