php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
Description:
------------
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:
<?php

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

Patches

Pull Requests

History

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] stas@php.net
Automatic comment on behalf of stas
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2c9926f156b2be6aa4f69a169d028c1ebc1eaa34
Log: Fix bug #78804 - Segmentation fault in Locale::filterMatches
 [2019-11-12 07:09 UTC] stas@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 14 20:01:26 2024 UTC