summaryrefslogtreecommitdiff
path: root/missing/dtoa.c
diff options
context:
space:
mode:
authorNAKAMURA Usaku <usa@ruby-lang.org>2022-04-12 20:25:48 +0900
committerNAKAMURA Usaku <usa@ruby-lang.org>2022-04-12 20:25:48 +0900
commitc9c2245c0a25176072e02db9254f0e0c84c805cd (patch)
tree61e80059a35598b3b2da400de2f6ff366fa1a89e /missing/dtoa.c
parent389723d85433df0b487f02c94ca6a243d39a189e (diff)
Fix dtoa buffer overrunv2_7_6
Diffstat (limited to 'missing/dtoa.c')
-rw-r--r--missing/dtoa.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/missing/dtoa.c b/missing/dtoa.c
index cbee13ee81..e82b60c2ce 100644
--- a/missing/dtoa.c
+++ b/missing/dtoa.c
@@ -1500,6 +1500,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) {
@@ -1522,7 +1523,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;
}
}