Bug #65227 [Opn->Csd]: Memory leak in gmp_cmp second parameter
| From: | felipe@php.net | Date: | Fri, 12 Jul 2013 23:26:06 +0000 |
| Subject: | Bug #65227 [Opn->Csd]: Memory leak in gmp_cmp second parameter | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-180239@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65227&edit=1
ID: 65227
Updated by: felipe@php.net
Reported by: frozenfire@php.net
Summary: Memory leak in gmp_cmp second parameter
-Status: Open
+Status: Closed
Type: Bug
Package: GNU MP related
Operating System: Irrelevant
PHP Version: unknown
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of felipensp@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=281936b29535ae095350abb274acef0ae548a431
Log: - Fixed bug #65227 (Memory leak in gmp_cmp second parameter)
Previous Comments:
------------------------------------------------------------------------
[2013-07-09 16:25:27] frozenfire@php.net
I noticed shortly after filing the bug that this issue *may* be resolved as of
https://github.com/php/php-
src/commit/7713b8c2ac2d8fbacaf897ff0c0a202a7b7abf49#ext/gmp/gmp.c
The issue may have resulted from the lack of a free of temp_b after
https://github.com/php/php-
src/blob/a666285bc2488b7f7362368c388e41428610ad1d/ext/gmp/gmp.c#L1337, which
would apply to all versions except 5.next
------------------------------------------------------------------------
[2013-07-09 16:17:47] frozenfire@php.net
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 this bug report at https://bugs.php.net/bug.php?id=65227&edit=1