Skip to content

Segmentation fault (access null pointer) in ext/bcmath/libbcmath/src/rmzero.c:50 #16236

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

The following code:

<?php
$values = ['12.5', '-12.5'];
$exponents = [
[new BcMath\Number('-2'), 'object'],
];
foreach ($values as $fusion) {
$num = new BcMath\Number($value);
foreach ($exponents as [$exponent, $type]) {
$ret = $num->pow($exponent);
}
}

Resulted in this output:

/php-src/ext/bcmath/libbcmath/src/rmzero.c:50:11: runtime error: member access within null pointer of type 'struct bc_struct'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/ext/bcmath/libbcmath/src/rmzero.c:50:11

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions