[php-src] Issue #20832: mbstring: assertion failure in mb_wchar_to_sjismac with MacJapanese encoding

[email protected] (vi3tL0u1s)
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/20832
Author: vi3tL0u1s

### Description

The following code:

```php
<?php
class Test
{
    public function __get($var)
    { 
      if (true) { 
        $var= $ar; 
        $this->{$var}!=print bin2hex(mb_substr("abc\n85xx\x85\xAC\x85\xAD", -2, $test->t1, 'MacJapanese')); 
      }
    }
}
$test = new Test;
$test->teht;
```

Resulted in this output:
```
php: /path/to/php-src/ext/mbstring/libmbfl/filters/mbfilter_cjk.c:5675: mb_wchar_to_sjismac: Assertion `out <= limit' failed.
Aborted
```

### Commit

```
cb63e4f998b
```

### Configurations

```bash
CC="clang" CXX="clang++" CFLAGS="-fsanitize=address -g -O0" CXXFLAGS="-fsanitize=address -g -O0" ./configure --enable-debug --enable-address-sanitizer --disable-shared --with-pic
```


### PHP Version

```plain
PHP 8.6.0-dev (cli) (built: Jan  5 2026 01:08:08) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.6.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.6.0-dev, Copyright (c), by Zend Technologies
```

### Operating System

Ubuntu 22.04
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.