Bug #78878 [Fbk->Opn]: Buffer underflow in bc_shift_addsub

From: Date: Fri, 29 Nov 2019 13:13:00 +0000
Subject: Bug #78878 [Fbk->Opn]: Buffer underflow in bc_shift_addsub
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223946@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78878&edit=1 ID: 78878 Updated by: cmb@php.net Reported by: thomas-josef dot riedmaier at siemens dot com Summary: Buffer underflow in bc_shift_addsub -Status: Feedback +Status: Open Type: Bug Package: BC math related Operating System: Windows PHP Version: 7.4.0 Assigned To: cmb Block user comment: N Private report: N New Comment: Thanks! That proves that the ² is encoded as a single byte (so it's not any Unicode encoding). Previous Comments: ------------------------------------------------------------------------ [2019-11-29 13:05:40] thomas-josef dot riedmaier at siemens dot com C:\Users\IEUser>C:\Users\IEUser\Desktop\php-7.4.0-Win32-vc15-x64\php.exe C:\Users\IEUser\Desktop\text.php Warning: Use of undefined constant ²6483605105519922841849335928742092 - assumed '²6483605105519922841849335928742092' (this will throw an Error in a future ver sion of PHP) in C:\Users\IEUser\Desktop\text.php on line 3 string(35) "²6483605105519922841849335928742092" ------------------------------------------------------------------------ [2019-11-29 10:21:43] cmb@php.net Hmm, pretty strange that the behavior depends on the Windows version, but of course, possible. Could you please post what you get when running <?php var_dump(²6483605105519922841849335928742092); Note that the charset/character encoding may very well matter here. ------------------------------------------------------------------------ [2019-11-29 08:48:57] thomas-josef dot riedmaier at siemens dot com If you need a test setup in which the bug can be reproduced go to https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ and download the "IE11 on Win7 (x86)" machine. You need to install VC Redistributables, but then you are good to go. ------------------------------------------------------------------------ [2019-11-29 07:37:54] thomas-josef dot riedmaier at siemens dot com I digged a little bit into this and it appears to be a system-dependent problem. When running the script with Windows7 SP1 or Windows Server 2016 (1607), the script says "Warning: Use of undefined constant �6483605105519922841849335928742092 - assumed '�6483605105519922841849335928742092'" and crashes. Note the non printable character here. When running the script with Windows 10 (1809), the scipt says "Warning: Use of undefined constant 6483605105519922841849335928742092 - assumed '6483605105519922841849335928742092'" and does not crash. Note that there is no unprintable character here. So it appears to me that depending on the Windows setup, php seem to ignore the '²', or not. If it is not ignored, an access violation occurs. ------------------------------------------------------------------------ [2019-11-28 16:02:31] cmb@php.net I cannot reproduce the access violation (neither with the given code, nor when I replace the ² with 2, nor when I just remove the ²). And neither does the assertion trigger in a debug build for me (it won't trigger in release builds anyway). Could you please fix/clarify the test script? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=78878 -- Edit this bug report at https://bugs.php.net/bug.php?id=78878&edit=1

« previous php.bugs (#223946) next »