From:             frozenf...@php.net
Operating system: Irrelevant
PHP version:      master-Git-2013-07-09 (Git)
Package:          GNU MP related
Bug Type:         Bug
Bug description:Memory leak in gmp_cmp second parameter

Description:
------------
Reporting this bug for a third party 
(http://www.reddit.com/r/PHP/comments/1hx7qz/what_is_going_on_here_how_do_i_fix_t
his_memory/), and related to a user note 
(http://www.php.net/manual/en/function.gmp-cmp.php#99120).

The gmp_cmp function leaks memory when a string is used as the value of the

second parameter.

My guess is that it relates to the way that the type is juggled in the
gmp_cmp 
function (https://github.com/php/php-src/blob/master/ext/gmp/gmp.c#L848),
where 
it checks the type of the second parameter to see if it's a long. It
doesn't 
however check if the second parameter is a string, or really any other
type.



Test script:
---------------
Third party's example code can be found at
http://www.reddit.com/r/PHP/comments/1hx7qz/what_is_going_on_here_how_do_i_fix_this_memory/


-- 
Edit bug report at https://bugs.php.net/bug.php?id=65227&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65227&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65227&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65227&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65227&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65227&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65227&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65227&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65227&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65227&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65227&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65227&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65227&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65227&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65227&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65227&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65227&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65227&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65227&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65227&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65227&r=mysqlcfg

Reply via email to