[php-src] Issue #11761: Out of memory for zero with trailing zeros in bcmath

From: Date: Fri, 21 Jul 2023 21:29:53 +0000
Subject: [php-src] Issue #11761: Out of memory for zero with trailing zeros in bcmath
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-245010@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/11761
Author: jorgsowa

### Description

The following code results in Out of memory error.

https://3v4l.org/vHJkg#v8.2.7

```php
<?php

var_dump(bcpow("0.000000000000000000000000000",737332323));
```

Resulted in this output:
```
Fatal error: Out of memory (allocated 28266496 bytes) (tried to allocate 7077891 bytes) in /in/vHJkg
on line 3
```

But I expected this output instead:
```
string(1) "0"
```


PR fixing this issue: https://github.com/php/php-src/pull/11641

### PHP Version

PHP 8.2

### Operating System

_No response_


Thread (1 message)

  • jorgsowa
« previous php.bugs (#245010) next »