Skip to content

Segmentation fault when cloning SoapServer #16237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
YuanchengJiang opened this issue Oct 5, 2024 · 1 comment
Closed

Segmentation fault when cloning SoapServer #16237

YuanchengJiang opened this issue Oct 5, 2024 · 1 comment

Comments

@YuanchengJiang
Copy link

Description

The following code:

<?php
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
$fusion = $server;
$ao2 = clone $fusion;

Resulted in this output:

/php-src/ext/soap/soap.c:4571:15: runtime error: member access within misaligned address 0x000000000123 for type 'struct _soapService', which requires 8 byte alignment
0x000000000123: note: pointer points here
<memory cannot be printed>
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/soap/soap.c:4571:15

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

@nielsdos
Copy link
Member

nielsdos commented Oct 5, 2024

Bisect points to 94ee4f9, which is unsurprising as this is the second time I see this.
Thing is that that commit only reveals the problem. Cloning this object shouldn't be possible in the first place.

@nielsdos nielsdos changed the title Segmentation fault in ext/soap/soap.c:4571 Segmentation fault when cloning SoapServer Oct 5, 2024
nielsdos added a commit to nielsdos/php-src that referenced this issue Oct 5, 2024
Bisect points to 94ee4f9, however this only reveals the problem.
Cloning an object on a lower branch and trying to call its methods
crashes as well. Cloning the object shouldn't be possible in the first
place because there's an engine constraint that when we have a new
object handler we should also have a clone handler. This constraint is
not fulfilled here.
@nielsdos nielsdos linked a pull request Oct 5, 2024 that will close this issue
nielsdos added a commit that referenced this issue Oct 5, 2024
* PHP-8.2:
  Fix GH-16237: Segmentation fault when cloning SoapServer
nielsdos added a commit that referenced this issue Oct 5, 2024
* PHP-8.3:
  Fix GH-16237: Segmentation fault when cloning SoapServer
nielsdos added a commit that referenced this issue Oct 5, 2024
* PHP-8.4:
  Fix GH-16237: Segmentation fault when cloning SoapServer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants