Commit Graph

187 Commits

Author SHA1 Message Date
Xinchen Hui
6d4aec029a Fixed test script 2016-03-17 17:06:56 +08:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Stanislav Malyshev
d735957cb5 Fix bug ##70284 (Use after free vulnerability in unserialize() with GMP) 2015-08-23 16:08:07 -07:00
Nikita Popov
1acf55eb75 Fixed bug #69803 2015-06-11 22:20:05 +02:00
Nikita Popov
25e45a9350 Run gmp_random tests more quickly 2015-04-16 16:29:57 +02:00
Nikita Popov
7e049b0427 Normalize gmp_remroot() behavior to GMP 5.1 2015-04-16 16:27:42 +02:00
Nikita Popov
8e167a2a00 Fix leak in gmp_pow() 2015-04-16 16:04:19 +02:00
Xinchen Hui
0579e8278d bump year 2015-01-15 23:26:37 +08:00
Rasmus Lerdorf
46f429f8e6 We can't output absolute S and T values for the
Diophantine solution here since it can vary based
on the libgmp version we are linking against and
in general there are almost always multiple valid
solutions
2015-01-09 16:23:50 -08:00
Remi Collet
1b15620744 Fix build with gmp < 4.2
See 3d6d863ccb
and acd7fcf55f
2014-11-13 13:08:00 +01:00
Remi Collet
0146505187 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  NEWS
  Fix bug #63595 GMP memory management conflicts with other libraries using GMP

Conflicts:
	ext/gmp/gmp.c
2014-10-27 07:50:42 +01:00
Remi Collet
3c925b18fa Fix bug #63595 GMP memory management conflicts with other libraries using GMP
Drop use of php memory allocators as this raise various conflicts
with other extensions and libraries which use libgmp.

No other solution found.
We cannot for ensure correct use of allocator with shared lib.

Some memory can allocated before php init
Some memory can be freed after php shutdown

Known broken run cases
- php + curl + gnutls + gmp
- mod_gnutls + mod_php + gnutls + gmp
- php + freetds + gnutls + gmp
- php + odbc + freetds + gnutls + gmp
- php + php-mapi (zarafa) + gnutls + gmp
2014-10-27 07:45:34 +01:00
Leigh
adf8f0f284 Address issues raised by @nikic
- Thread safety on rand init function.
 - Ret false on validation failure
 - Add _dep of temp_a to temp_b
 - Special case int sized min values
 - More tests!
2014-09-24 22:01:09 +01:00
Leigh
3e9a31748d Make sure min < max 2014-09-24 07:56:46 +01:00
Leigh
acd7fcf55f Mersenne Twister was added in GMP 4.2 2014-09-23 23:16:26 +01:00
Leigh
31e27fc89a Add test files 2014-09-23 22:54:40 +01:00
Leigh
831bb9260c Add gmp_random_bits(bits) and gmp_random_range(min, max) 2014-09-23 22:12:23 +01:00
Leigh
3d6d863ccb Change GMPs default PRNG to Mersenne Twister
Since we don't allow users to seed the RNG, there is no BC issue with changing the generator.
2014-09-23 19:51:56 +01:00
Nikita Popov
03797a73b2 Split GMP tests testing multiple functions
Also drop dummy test
2014-09-04 21:18:37 +02:00
Nikita Popov
9586b15229 Give proper names to GMP test files 2014-09-04 21:10:41 +02:00
Nikita Popov
15c139b99a Throw warnings when using zero modulus in gmp_powm
Also fixes a leak in this case.
2014-09-04 20:55:09 +02:00
Nikita Popov
f10d194c8c Add GMP tests for some uncovered branches 2014-09-04 20:03:29 +02:00
Nikita Popov
834daa455b Fixed bug #50175
0x and 0b prefix is now only handled if either no base is given
or if the base is 16 (0x) or 2 (0b). Always handling it is incorrect
because 0x and 0b are perfectly valid numbers in other bases.
2014-09-02 19:04:55 +02:00
Nikita Popov
7533243f0c Fix C89 build and small cleanup 2014-09-02 18:52:13 +02:00
Leigh
47d630e7f0 Implement gmp_import() and gmp_export() 2014-09-02 14:19:18 +02:00
Nikita Popov
fc5f931663 Fix bug #67917 (gmp compound assignment operator leak) 2014-08-27 22:16:20 +02:00
Stanislav Malyshev
c18ae51aeb Fix crashes in GMP serialize/unserialize 2014-04-28 01:22:02 -07:00
Nikita Popov
5e93a213f6 Add SKIPIF in GMP test 2014-03-12 14:17:08 +01:00
Nikita Popov
a117e6b937 Add tests for bug #66872 and gmp_[rem]root 2014-03-11 14:06:12 +01:00
Anatol Belski
72050af855 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  restored the old code in 5.4/5 related to bug #66872
2014-03-11 11:51:35 +01:00
Anatol Belski
1a624e27a6 restored the old code in 5.4/5 related to bug #66872
The crash is reproducable in 5.6+ only, so 5.4 and 5.5 are fine
with the old code.
2014-03-11 11:50:14 +01:00
Pierre Joye
eef2978afc Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  fix #66872, invalid argument crashes gmp_testbit
  fix #66872, invalid argument crashes gmp_testbit
  add vc12 (2013)

Conflicts:
	ext/gmp/gmp.c
2014-03-10 12:18:57 +01:00
Pierre Joye
d2e42d5372 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  fix #66872, invalid argument crashes gmp_testbit
  fix #66872, invalid argument crashes gmp_testbit
  add vc12 (2013)

Conflicts:
	win32/build/confutils.js
2014-03-10 12:10:57 +01:00
Pierre Joye
af41914e15 fix #66872, invalid argument crashes gmp_testbit 2014-03-10 12:06:40 +01:00
datibbaw
aff56f3c45 add T_POW (**) operator
Fixed recognition of the operator

Added opcode, still doing multiply instead of pow()

opcode now always returns int(42)

The right answer, but always a float

Yanked code from pow() implementation.

Should not handle negative long as exponent ourselves

Added test cases from pow()

Moved precedence higher than '~'

Added GMP operator overloading

Added ZEND_ASSIGN_POW (**=) operator.

Added pow() as a language construct.

Adjusted test cases for changed precedence.

Reduced pow() to shell function around ZEND_API pow_function()

Reduced test case to only contain edge cases
Added overloading test case

Moved unary minus above T_POW

Revert "Added pow() as a language construct."

Bad bad bad idea.

This reverts commit f60b98cf7a8371233d800a6faa286ddba4432d02.

Reverted unary minus behaviour due to previous revert.
Convert arrays to int(0)
Exponent with array as a base becomes int(0)

Rebase against master

Fixed tokenizer test case
2014-02-06 14:41:21 +01:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Xinchen Hui
47c9027772 Bump year 2014-01-03 11:06:16 +08:00
Xinchen Hui
c0d060f5c0 Bump year 2014-01-03 11:04:26 +08:00
Nikita Popov
5408f1e5a6 Throw warning when converting invalid string to GMP 2013-12-30 14:38:09 +01:00
Nikita Popov
00c74ccf69 Support gmp_remroot() on GMP 4.1 2013-12-02 20:11:06 +01:00
Nikita Popov
f54f308f71 Clean up GMP arginfos
Removed duplicate arginfos, specified number of required args
everywhere and removed weird pass-by-ref arguments.
2013-11-29 00:05:28 +01:00
Nikita Popov
6d38090c8d Add gmp_root() and gmp_rootrem() functions 2013-11-29 00:01:59 +01:00
Nikita Popov
1c8cbe4b4e Use class handlers for GMP serialization
A bit faster and less boilerplate
2013-11-29 00:01:59 +01:00
Nikita Popov
8860758a74 Remove duplicate / commented code in GMP 2013-11-29 00:01:59 +01:00
Nikita Popov
4218e89f8d Fix bug #65997 by switching to Serializable for GMP
Rather than using get_properties and __wakeup for serialization
the code now uses Serializable::serialize() and
Serializable::unserialize(). The get_properties handler is switched
to a get_debug_info handler. Thus get_gc will now return only
the normal properties and not do any modifications, thus fixing
the leak. This also avoids a $num property from being publicly
visible after the object was dumped or serialized, so that's an
extra plus.
2013-10-29 20:58:30 +01:00
Nikita Popov
647e0be64b Fix compile warning in GMP 2013-10-29 20:07:34 +01:00
Christopher Jones
3c166c4758 Merge branch 'PHP-5.5'
* PHP-5.5:
  Reduce (some) compile noise of 'unused variable' and 'may be used uninitialized' warnings.

Conflicts:
	ext/gmp/gmp.c
2013-08-14 20:47:00 -07:00
Christopher Jones
39612afc72 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Reduce (some) compile noise of 'unused variable' and 'may be used uninitialized' warnings.

Conflicts:
	ext/dba/libinifile/inifile.c
2013-08-14 20:43:25 -07:00
Christopher Jones
9ad97cd489 Reduce (some) compile noise of 'unused variable' and 'may be used uninitialized' warnings. 2013-08-14 20:36:50 -07:00
Christopher Jones
4c3c9d1fe5 Merge branch 'PHP-5.5'
* PHP-5.5:
  Fix long-standing visual pain point: the misalignment of './configure help' text. Whitespace changes and a couple of grammar fixes.
2013-08-06 11:09:12 -07:00