In perl.git, the branch blead has been updated <https://perl5.git.perl.org/perl.git/commitdiff/aac39b038830b7472ba3f079b4aee72cb2076c2e?hp=0657084328c6c5c8225ddf2ce8238561011f6bff>
- Log ----------------------------------------------------------------- commit aac39b038830b7472ba3f079b4aee72cb2076c2e Author: Karl Williamson <k...@cpan.org> Date: Fri Jan 18 11:30:00 2019 -0700 my_atof3() Fix uncommon bug where it wrongly fails This bug showed up only on -Dusemymalloc without Debugging, and without various other common Configure options. It causes my_atof3() to return failure where in fact success was achieved. It apparently got triggered due to slight differences in malloc behaviors. The bug is that it changed a string pointer to new memory and forgot to change it back to the original value when that memory got freed. The test that fails is an equal/not equal of two pointers, and usually two pointers aren't the same, meaning the bug doesn't appear. The only case where my_atof3() is called is in parsing certain \p{nv=...} where "..." is not a rational number. So the scope of this bug is limited. Spotted by Ryan Voots. ----------------------------------------------------------------------- Summary of changes: numeric.c | 1 + 1 file changed, 1 insertion(+) diff --git a/numeric.c b/numeric.c index e5e08cb241..9804a9b341 100644 --- a/numeric.c +++ b/numeric.c @@ -1465,6 +1465,7 @@ Perl_my_atof3(pTHX_ const char* orig, NV* value, STRLEN len) /* If we created a copy, 'endp' is in terms of that. Convert back to * the original */ if (copy) { + s = (s - copy) + (char *) orig; endp = (endp - copy) + (char *) orig; Safefree(copy); } -- Perl5 Master Repository