|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78804 Segmentation fault in Locale::filterMatches
Submitted: 2019-11-11 22:36 UTC Modified: 2019-11-11 22:40 UTC
From: chris dot lee at encapto dot com Assigned:
Status: Closed Package: intl (PECL)
PHP Version: 7.3.11 OS: Linux 5.3.8-arch1-1
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: chris dot lee at encapto dot com
New email:
PHP Version: OS:


 [2019-11-11 22:36 UTC] chris dot lee at encapto dot com
Version number: PHP 7.3.11 (cli) (built: Oct 23 2019 16:31:28) ( NTS )

Configure Command =>  './configure'  '--srcdir=../php-7.3.11' '--config-cache' '--prefix=/usr' '--sbindir=/usr/bin' '--sysconfdir=/etc/php' '--localstatedir=/var' '--with-layout=GNU' '--with-config-file-path=/etc/php' '--with-config-file-scan-dir=/etc/php/conf.d' '--disable-rpath' '--mandir=/usr/share/man' '--without-pear' '--enable-cgi' '--enable-fpm' '--with-fpm-systemd' '--with-fpm-acl' '--with-fpm-user=http' '--with-fpm-group=http' '--enable-embed=shared' '--enable-bcmath=shared' '--enable-calendar=shared' '--enable-dba=shared' '--enable-exif=shared' '--enable-ftp=shared' '--enable-intl=shared' '--enable-mbstring' '--enable-shmop=shared' '--enable-soap=shared' '--enable-sockets=shared' '--enable-sysvmsg=shared' '--enable-sysvsem=shared' '--enable-sysvshm=shared' '--enable-zip=shared' '--with-bz2=shared' '--with-curl=shared' '--with-db4=/usr' '--with-enchant=shared,/usr' '--with-freetype-dir=/usr' '--with-gd=shared,/usr' '--with-gdbm' '--with-gettext=shared' '--with-gmp=shared' '--with-iconv=shared' '--with-imap-ssl' '--with-imap=shared' '--with-kerberos=/usr' '--with-ldap=shared' '--with-ldap-sasl' '--with-libzip' '--with-mhash' '--with-mysql-sock=/run/mysqld/mysqld.sock' '--with-mysqli=shared,mysqlnd' '--with-openssl' '--with-password-argon2' '--with-pcre-regex=/usr' '--with-pdo-dblib=shared,/usr' '--with-pdo-mysql=shared,mysqlnd' '--with-pdo-odbc=shared,unixODBC,/usr' '--with-pdo-pgsql=shared' '--with-pdo-sqlite=shared,/usr' '--with-pgsql=shared' '--with-pspell=shared' '--with-readline' '--with-snmp=shared' '--with-sodium=shared' '--with-sqlite3=shared,/usr' '--with-tidy=shared' '--with-unixODBC=shared,/usr' '--with-xmlrpc=shared' '--with-xsl=shared' '--with-zlib' '--enable-pcntl'

Short summary:
I found some of the browsers are sending HTTP_ACCEPT_LANGUAGE header with 'und', which means 'undetermined'. Whenever you try to filter match with this locale, it throws segmentation fault.

Test script:
Problem code:

if (Locale::filterMatches('en-US', 'und', true)) {
    echo 'Matches';
} else {
    echo 'Not matches';

Expected result:
$ php poc.php 
Segmentation fault (core dumped)

Actual result:
Segmentation fault


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-11-11 22:40 UTC] chris dot lee at encapto dot com
Expected result:
Return 'Not match'

Actual result:
$ php poc.php 
Segmentation fault (core dumped)
 [2019-11-12 07:09 UTC]
Automatic comment on behalf of stas
Log: Fix bug #78804 - Segmentation fault in Locale::filterMatches
 [2019-11-12 07:09 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 04 04:01:27 2023 UTC