php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61139 gzopen leaks when specifying invalid mode
Submitted: 2012-02-19 14:22 UTC Modified: 2012-08-09 16:14 UTC
From: nikic@php.net Assigned: nikic
Status: Closed Package: Zlib related
PHP Version: Irrelevant OS:
Private report: No CVE-ID:
 [2012-02-19 14:22 UTC] nikic@php.net
Description:
------------
gzopen('someFile', 'c');

Leaks:

Warning: gzopen(): gzopen failed in 
/home/nikic/dev/Phuzzy/results/reproduceCode9_gzopen_memoryLeak.php on line 3
/home/nikic/dev/php-src/trunk/main/streams/streams.c(509) : Stream of type 
'STDIO' 0xb76e9024 (path:someFile) was not closed
[Sun Feb 19 15:20:17 2012]  Script:  'reproduceCode9_gzopen_memoryLeak.php'
/home/nikic/dev/php-src/trunk/main/streams/streams.c(273) :  Freeing 0xB76E9024 
(140 bytes), script=reproduceCode9_gzopen_memoryLeak.php
/home/nikic/dev/php-src/trunk/ext/zlib/zlib_fopen_wrapper.c(131) : Actual 
location (location was relayed)
=== Total 1 memory leaks detected ===


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-19 14:39 UTC] nikic@php.net
Automatic comment from SVN on behalf of nikic
Revision: http://svn.php.net/viewvc/?view=revision&revision=323362
Log: Fix bug #61139 gzopen leaks when specifying invalid mode

Needs to be merged to 5.4.
 [2012-02-19 14:41 UTC] nikic@php.net
Keeping open til merged to 5.4.
 [2012-02-19 14:41 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2012-03-02 14:16 UTC] nikic@php.net
Automatic comment from SVN on behalf of nikic
Revision: http://svn.php.net/viewvc/?view=revision&revision=323819
Log: Merge: Fix bug #61139: gzopen leaks when specifying invalid mode
 [2012-03-02 14:17 UTC] nikic@php.net
-Status: Assigned +Status: Closed
 [2012-04-18 09:46 UTC] laruence@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ecd13fd184ab46136d893338748fcda6c1458c7f
Log: Fix bug #61139 gzopen leaks when specifying invalid mode
 [2012-07-24 23:37 UTC] rasmus@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ecd13fd184ab46136d893338748fcda6c1458c7f
Log: Fix bug #61139 gzopen leaks when specifying invalid mode
 [2012-07-29 06:17 UTC] laruence@php.net
-Status: Closed +Status: Re-Opened
 [2012-07-29 06:17 UTC] laruence@php.net
valgrind complains :
==21723== Conditional jump or move depends on uninitialised value(s)
==21723==    at 0x3055402F6A: ??? (in /usr/lib64/libz.so.1.2.3)
==21723==    by 0x30554040A0: ??? (in /usr/lib64/libz.so.1.2.3)
==21723==    by 0x3055404184: gzdopen (in /usr/lib64/libz.so.1.2.3)
==21723==    by 0x572A0D: php_stream_gzopen (zlib_fopen_wrapper.c:137)
==21723==    by 0x5711C7: zif_gzopen (zlib.c:592)
==21723==    by 0x9A424E: zend_do_fcall_common_helper_SPEC 
(zend_vm_execute.h:642)
==21723==    by 0x9ADB2B: ZEND_DO_FCALL_SPEC_CONST_HANDLER 
(zend_vm_execute.h:2219)
==21723==    by 0x9A1E43: execute (zend_vm_execute.h:410)
==21723==    by 0x95C1A9: zend_execute_scripts (zend.c:1289)
==21723==    by 0x89AAF3: php_execute_script (main.c:2473)
==21723==    by 0xAE4268: do_cli (php_cli.c:988)
==21723==    by 0xAE5700: main (php_cli.c:1364)
==21723==
 [2012-08-09 16:14 UTC] nikic@php.net
The invalid move occurs within zlib, so this is rather a 3rd party issue. The only thing we could do here is manually check whether the mode is valid.
 [2012-08-09 16:14 UTC] nikic@php.net
-Status: Re-Opened +Status: Closed
 [2013-11-17 09:33 UTC] laruence@php.net
Automatic comment on behalf of nikic
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ecd13fd184ab46136d893338748fcda6c1458c7f
Log: Fix bug #61139 gzopen leaks when specifying invalid mode
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 13:02:46 2014 UTC