diff options
author | John Lightsey <john@04755.net> | 2020-08-20 15:53:57 -0500 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-08-21 21:36:32 -0600 |
commit | bbd8607595f9856d6e75ed63130034cf645feb4a (patch) | |
tree | 830e76685b87d2a67c7905c1d3f91500c951d911 /numeric.c | |
parent | c2e6241c83ac9b30fb37984a432bff9801cc2a3a (diff) | |
download | perl-bbd8607595f9856d6e75ed63130034cf645feb4a.tar.gz |
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.
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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++; } } @@ -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 |