Skip to content

Commit 13ff090

Browse files
lightseysteve-m-hay
authored andcommitted
Add missing boundary check to grok_infnan
The grok_infnan() function was walking past the end of the string while skipping over trailing '0' characters. This is another variation of #17370. (cherry picked from commit bbd8607)
1 parent 95fb4b6 commit 13ff090

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

numeric.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ Perl_grok_infnan(pTHX_ const char** sp, const char* send)
784784
s++; if (s == send || isALPHA_FOLD_NE(*s, 'Y')) return fail;
785785
s++;
786786
} else if (odh) {
787-
while (*s == '0') { /* 1.#INF00 */
787+
while (s < send && *s == '0') { /* 1.#INF00 */
788788
s++;
789789
}
790790
}
@@ -798,10 +798,10 @@ Perl_grok_infnan(pTHX_ const char** sp, const char* send)
798798
else if (isALPHA_FOLD_EQ(*s, 'D') && odh) { /* 1.#IND */
799799
s++;
800800
flags |= IS_NUMBER_NAN | IS_NUMBER_NOT_INT;
801-
while (*s == '0') { /* 1.#IND00 */
801+
while (s < send && *s == '0') { /* 1.#IND00 */
802802
s++;
803803
}
804-
if (*s) {
804+
if (s < send && *s) {
805805
flags |= IS_NUMBER_TRAILING;
806806
}
807807
} else

0 commit comments

Comments
 (0)