php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79757 Segmentation fault error when using file_get_contents() function with ssh2.sftp
Submitted: 2020-06-29 13:15 UTC Modified: 2021-01-14 12:59 UTC
From: janis dot mozgis at printful dot com Assigned: cmb (profile)
Status: Closed Package: ssh2 (PECL)
PHP Version: 7.4.7 OS: Ubuntu 18 / Opensuse
Private report: No CVE-ID: None
 [2020-06-29 13:15 UTC] janis dot mozgis at printful dot com
Description:
------------
We are getting "segmentation fault" error when trying to use file_get_contents() + stream context with ssh2.sftp wrapper. 
It works with ssh2_connect() + ssh2_sftp() functions, but not with creating the stream context.


PHP: v7.4
ssh2 package: v1.2
Tested with Ubuntu and opensuse OSes, same result.

Test script:
---------------
$options = [
    "ssh2" => [
        "username" => "user",
        "pubkey_file" => 'path/to/key.pub',
        "privkey_file" => 'path/to/key'
    ]
];
$context = stream_context_create($options, []);
file_get_contents('ssh2.sftp://domain.com/path/to/file', false, $context);


Expected result:
----------------
File content

Actual result:
--------------
segmentation fault error

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-08-13 09:56 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Bug #79757 segfault when passing NULL to zend_list_delete
On GitHub:  https://github.com/php/php-src/pull/5980
Patch:      https://github.com/php/php-src/pull/5980.patch
 [2021-01-14 12:59 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC