Bug #77284 [Com]: base64

From: Date: Wed, 12 Dec 2018 09:52:05 +0000
Subject: Bug #77284 [Com]: base64
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218413@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77284&edit=1 ID: 77284 Comment by: sjon at hortensius dot net Reported by: anubas at hotmail dot com Summary: base64 Status: Assigned Type: Bug Package: *URL Functions Operating System: FreeBSD 11.2-RELEASE-p5 PHP Version: 7.3.0 Assigned To: laruence Block user comment: N Private report: N New Comment: This can be reproduced pretty quickly in a qemu-vm - I downloaded http://ftp.nl.freebsd.org/releases/VM-IMAGES/11.2-RELEASE/amd64/Latest/FreeBSD-11.2-RELEASE-amd64.qcow2.xz, uncompressed and logged in with root and ran: # portsnap fetch extract && cd /usr/ports/lang/php73 && make install (select debug build, accept defaults for the rest This will get you a debug php73 build which shows the same behavior Previous Comments: ------------------------------------------------------------------------ [2018-12-11 22:12:28] nikic@php.net Also bug #77279 looks very related. In both cases we have a SIMD optimized function with FreeBSD as the operating system. Likely the same root cause. ------------------------------------------------------------------------ [2018-12-11 22:11:21] nikic@php.net Thanks, that should put you on the SSSE3 implementation. I just tried to force it locally, and it's working fine for me. Not sure what could be the issue here, maybe laruence has an idea? ------------------------------------------------------------------------ [2018-12-11 21:53:41] anubas at hotmail dot com I pulled the following out of the system dmesg output: CPU: Intel(R) Xeon(R) CPU E5-2630 v2 @ 2.60GHz (2600.00-MHz K8-class CPU) Origin="GenuineIntel" Id=0x306e4 Family=0x6 Model=0x3e Stepping=4 Features=0xfa3fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,DTS,MMX,FXSR,SSE,SSE2,SS> Features2=0xffba2203<SSE3,PCLMULQDQ,SSSE3,CX16,PCID,SSE4.1,SSE4.2,x2APIC,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND,HV> AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM> AMD Features2=0x1<LAHF> Structured Extended Features=0x283<FSGSBASE,TSCADJ,SMEP,ERMS> TSC: P-state invariant ------------------------------------------------------------------------ [2018-12-11 21:41:20] nikic@php.net Base64 encoding has SIMD based implementations in 7.3, so this issue might be architecture dependent. Can you please tell me which SIMD extensions your CPU supports? In particular AVX2 and SSSE3 support would be relevant. ------------------------------------------------------------------------ [2018-12-11 21:28:26] anubas at hotmail dot com The following code: <?php $x = 'This is a string'; $y = base64_encode($x); $z = base64_decode($y); var_dump($x) . '<br />'; var_dump($y) . '<br />'; var_dump($z) . '<br />'; Produces: string(16) "This is a string" string(-6072743447921604100) " 2018/12/11 13:24:05 [error] 91715#100408: *63 FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 12374000625787949056 bytes) in [FILE] on line 8" while reading response header from upstream, client: [IP], server: [SERVER], request: "GET /[FILE] HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "[SERVER]" It appears the output from base64_encode() is invalid. ------------------------------------------------------------------------ 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=77284 -- Edit this bug report at https://bugs.php.net/bug.php?id=77284&edit=1

« previous php.bugs (#218413) next »