Bug #75363 [Opn->Csd]: openssl_x509_parse leaks memory

From: Date: Thu, 12 Oct 2017 10:30:38 +0000
Subject: Bug #75363 [Opn->Csd]: openssl_x509_parse leaks memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211638@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75363&edit=1 ID: 75363 Updated by: bwoebi@php.net Reported by: kelunik@php.net Summary: openssl_x509_parse leaks memory -Status: Open +Status: Closed Type: Bug Package: OpenSSL related Operating System: Linux PHP Version: 7.2.0RC4 Block user comment: N Private report: N New Comment: Automatic comment on behalf of bobwei9@hotmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=a55af1e2719d2f0abac21a9a3db04f960b4fbd38 Log: Fixed bug #75363 (openssl_x509_parse leaks memory) Previous Comments: ------------------------------------------------------------------------ [2017-10-12 08:21:05] kelunik@php.net Description: ------------ openssl_x509_parse leaks memory, which is never freed again. Test certificate is the Let's Encrypt root certificate: https://letsencrypt.org/certs/isrgrootx1.pem.txt https://bugs.php.net/bug.php?id=38261 is already closed and is only about invalid certificates. Test script: --------------- <?php $pem = file_get_contents(__DIR__ . "/test.crt"); $i = 0; while (true) { $cert = openssl_x509_read($pem); $info = openssl_x509_parse($cert); // <-- without it, it doesn't leak openssl_x509_free($cert); unset($cert); if ($i++ % 10000 === 0) { print PHP_EOL; print memory_get_usage(true); print PHP_EOL; } } Expected result: ---------------- 2097152 2097152 2097152 2097152 2097152 2097152 2097152 2097152 Actual result: -------------- 2097152 2097152 4194304 4194304 6295552 6295552 6295552 8392704 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75363&edit=1

« previous php.bugs (#211638) next »