Skip to content

Commit

Permalink
Add missing boundary check to grok_infnan
Browse files Browse the repository at this point in the history
The grok_infnan() function was walking past the end of the string
while skipping over trailing '0' characters. This is another
variation of #17370.
  • Loading branch information
lightsey authored and khwilliamson committed Aug 22, 2020
1 parent c2e6241 commit bbd8607
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ Perl_grok_infnan(pTHX_ const char** sp, const char* send)
s++; if (s == send || isALPHA_FOLD_NE(*s, 'Y')) return fail;
s++;
} else if (odh) {
while (*s == '0') { /* 1.#INF00 */
while (s < send && *s == '0') { /* 1.#INF00 */
s++;
}
}
Expand All @@ -798,10 +798,10 @@ Perl_grok_infnan(pTHX_ const char** sp, const char* send)
else if (isALPHA_FOLD_EQ(*s, 'D') && odh) { /* 1.#IND */
s++;
flags |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT;
while (*s == '0') { /* 1.#IND00 */
while (s < send && *s == '0') { /* 1.#IND00 */
s++;
}
if (*s) {
if (s < send && *s) {
flags |= IS_NUMBER_TRAILING;
}
} else
Expand Down

0 comments on commit bbd8607

Please sign in to comment.