Bug 1213416

Summary: php: NULL pointer dereference at ext/ereg/regex/regcomp.c
Product: [Other] Security Response Reporter: Vasyl Kaigorodov <vkaigoro>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED NOTABUG QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: bleanhar, ccoleman, dmcphers, fedora, jdetiber, jialiu, jkeck, jokerman, jorton, jrusnack, kseifried, lmeyer, mmaslano, mmccomas, rcollet, webstack-team
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: php 5.4.40, php 5.5.24, php 5.6.8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-28 20:45:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1213456    
Bug Blocks: 1213462    

Description Vasyl Kaigorodov 2015-04-20 13:59:02 UTC
PHP versions 5.4.40, 5.5.24 and 5.6.8 provide a fix for NULL pointer dereference leading to an application crash in ext/ereg/regex/regcomp.c.

From upstream bug:
"""
An explicit null deference happens in /ext/ereg/regex/regcomp.c:

  140        g->setbits = NULL;

then this is called:

  167        categorize(p, g);

which does this:

  1326                if (cats[c] == 0 && isinsets(g, c)) {

And then the isinsets function does this:

  1279        for (i = 0, col = g->setbits; i < ncols; i++, col += g->csetsize)
  1280                if (col[uc] != 0)
  1281                        return(1);

which will cause a crash.
"""

Upstream fix:
http://git.php.net/?p=php-src.git;a=commitdiff;h=124fb22a13fafa3648e4e15b4f207c7096d8155e

Upstream bug:
https://bugs.php.net/bug.php?id=68740

Comment 1 Vasyl Kaigorodov 2015-04-20 15:25:04 UTC
Created php tracking bugs for this issue:

Affects: fedora-all [bug 1213456]

Comment 2 Fedora Update System 2015-04-22 22:51:54 UTC
php-5.6.8-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 3 Fedora Update System 2015-04-23 16:11:01 UTC
php-5.6.8-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 4 Fedora Update System 2015-04-27 08:39:32 UTC
php-5.5.24-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 5 Tomas Hoger 2015-05-28 20:45:51 UTC
This NULL dereference does not seem practically reachable as I noted in upstream bug:

https://bugs.php.net/bug.php?id=68740#1432845447

g->setbits is allocated before it can be dereferenced in isinsets().