Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:57905 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30946 invoked from network); 19 Feb 2012 09:12:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2012 09:12:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@ktamura.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@ktamura.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ktamura.com from 209.85.160.42 cause and error) X-PHP-List-Original-Sender: me@ktamura.com X-Host-Fingerprint: 209.85.160.42 mail-pw0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:53089] helo=mail-pw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F2/82-00837-FFCB04F4 for ; Sun, 19 Feb 2012 04:12:33 -0500 Received: by pbcwz12 with SMTP id wz12so6040289pbc.29 for ; Sun, 19 Feb 2012 01:12:27 -0800 (PST) Received-SPF: pass (google.com: domain of me@ktamura.com designates 10.68.218.228 as permitted sender) client-ip=10.68.218.228; Authentication-Results: mr.google.com; spf=pass (google.com: domain of me@ktamura.com designates 10.68.218.228 as permitted sender) smtp.mail=me@ktamura.com Received: from mr.google.com ([10.68.218.228]) by 10.68.218.228 with SMTP id pj4mr42792283pbc.167.1329642747784 (num_hops = 1); Sun, 19 Feb 2012 01:12:27 -0800 (PST) Received: by 10.68.218.228 with SMTP id pj4mr35583352pbc.167.1329642746706; Sun, 19 Feb 2012 01:12:26 -0800 (PST) Received: from [192.168.1.108] (adsl-71-142-77-5.dsl.pltn13.pacbell.net. [71.142.77.5]) by mx.google.com with ESMTPS id o7sm21615219pbq.8.2012.02.19.01.12.24 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Feb 2012 01:12:25 -0800 (PST) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Sun, 19 Feb 2012 01:12:22 -0800 Message-ID: <7EE22932-A1BC-4AC2-8AE8-AA697B96D0F9@ktamura.com> To: internals@lists.php.net Mime-Version: 1.0 (Apple Message framework v1084) X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQmXYvEpV/HMfXM9Hj/Lvl2Q1QGLd2tpkYXIEhg+k1kLhY6oyJ9bENGfKD4zC96VT0Un9Wts Subject: A patch for Bug #61124 From: me@ktamura.com (Kiyoto Tamura) I propose the following patch to prevent segfault for openssl_decrypt as = detailed in https://bugs.php.net/bug.php?id=3D61124 Index: ext/openssl/openssl.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- ext/openssl/openssl.c (revision 323312) +++ ext/openssl/openssl.c (working copy) @@ -4801,6 +4801,10 @@ base64_str =3D (char*)php_base64_decode((unsigned = char*)data, data_len, &base64_str_len); data_len =3D base64_str_len; data =3D base64_str; + if (data =3D=3D NULL) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, = "Failed to decode the base64 input"); + RETURN_FALSE; + } } =20 keylen =3D EVP_CIPHER_key_length(cipher_type); Feedback is appreciated. Thanks! Kiyoto=