|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79140 Stack smashing detected error in PHP 7.4.1
Submitted: 2020-01-20 08:36 UTC Modified: 2020-01-23 14:36 UTC
From: enumag at gmail dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 7.4.1 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: enumag at gmail dot com
New email:
PHP Version: OS:


 [2020-01-20 08:36 UTC] enumag at gmail dot com
You don't need to have postgres installed or running - I don't. This fails regardless.

Reproducing code is taken from amphp/postgres readme

Test script:
<?php declare(strict_types = 1);

use Amp\Postgres;
use Amp\Postgres\ConnectionConfig;
use Amp\Sql\Statement;

require __DIR__.'/vendor/autoload.php';

Amp\Loop::run(function () {
	$config = ConnectionConfig::fromString("host=localhost user=postgres dbname=test");

	/** @var Postgres\Pool $pool */
	$pool = Postgres\pool($config);

	/** @var Statement $statement */
	$statement = yield $pool->prepare("SELECT * FROM test WHERE id = :id");

	/** @var Postgres\ResultSet $result */
	$result = yield $statement->execute(['id' => 1337]);
	while (yield $result->advance()) {
		$row = $result->getCurrent();
		// $row is an array (map) of column values. e.g.: $row['column_name']

Expected result:
Some normal amphp/postgres error saying that connecting to postgres failed.

Actual result:
*** stack smashing detected ***: <unknown> terminated
[1]    4059 abort (core dumped)  php amp.php


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-20 08:46 UTC]
I can't reproduce this with current 7.4 HEAD. I get:

Fatal error: Uncaught Amp\Sql\ConnectionException: fe_sendauth: no password supplied in /home/nikic/repos/postgres/src/PgSqlConnection.php:58
Stack trace:
#0 /home/nikic/repos/postgres/vendor/amphp/amp/lib/Loop/NativeDriver.php(223): Amp\Postgres\PgSqlConnection::Amp\Postgres\{closure}('e', Resource id #53, NULL)
#1 /home/nikic/repos/postgres/vendor/amphp/amp/lib/Loop/NativeDriver.php(97): Amp\Loop\NativeDriver->selectStreams(Array, Array, 0.421)
#2 /home/nikic/repos/postgres/vendor/amphp/amp/lib/Loop/Driver.php(134): Amp\Loop\NativeDriver->dispatch(true)
#3 /home/nikic/repos/postgres/vendor/amphp/amp/lib/Loop/Driver.php(72): Amp\Loop\Driver->tick()
#4 /home/nikic/repos/postgres/vendor/amphp/amp/lib/Loop.php(84): Amp\Loop\Driver->run()
#5 /home/nikic/repos/postgres/test.php(24): Amp\Loop::run(Object(Closure))
#6 {main}
  thrown in /home/nikic/repos/postgres/src/PgSqlConnection.php on line 58

without any warnings under valgrind.
 [2020-01-20 09:01 UTC] enumag at gmail dot com
Is it possible that it was fixed since 7.4.1 release? I reproduced it on 2 separate machines.

I'm trying to reproduce it in Docker but running into some issues when building the image...
 [2020-01-20 11:20 UTC] enumag at gmail dot com
It seems to only happen with ext-event. Using ext-uv instead works so far.
 [2020-01-23 14:36 UTC]
-Status: Open +Status: Not a bug
 [2020-01-23 14:36 UTC]
In all likelihood this is a bug in ext-event then.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 04 19:01:16 2020 UTC