Commit Graph

384 Commits

Author SHA1 Message Date
Nikita Popov
305f3c2b76 Merge branch 'PHP-7.0' into PHP-7.1 2017-03-09 20:48:24 +01:00
Nikita Popov
177f87cf05 Fixed bug #73370
If len=0 malloc() is allowed to return NULL.
2017-03-09 20:47:06 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Nikita Popov
33e96c9d63 Merge branch 'PHP-7.0' into PHP-7.1 2016-12-14 18:11:43 +01:00
Nikita Popov
f99bf70360 Partially fix bug #70492
The libmagic portion is missing.
2016-12-14 18:11:27 +01:00
Dmitry Stogov
4616441980 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fixded bug #72736 (Slow performance when fetching large dataset with mysqli / PDO)
2016-10-26 15:22:51 +03:00
Dmitry Stogov
3fb0a1a4e7 Fixded bug #72736 (Slow performance when fetching large dataset with mysqli / PDO) 2016-10-26 15:17:09 +03:00
Anatol Belski
d35d9d1d0e missed piece for renaming
(cherry picked from commit 5ba9eab436)
2016-10-14 02:08:28 +02:00
Stanislav Malyshev
0362d61ab7 Fix potential overflows in php_pcre_replace_impl
(cherry picked from commit 9c50ba42d6)
2016-10-14 01:57:55 +02:00
Anatol Belski
5ba9eab436 missed piece for renaming 2016-10-13 15:39:02 +02:00
Stanislav Malyshev
9c50ba42d6 Fix potential overflows in php_pcre_replace_impl 2016-10-12 23:07:47 -07:00
Christoph M. Becker
75a1384ebf Merge branch 'PHP-7.0' into PHP-7.1 2016-09-24 18:18:34 +02:00
Christoph M. Becker
bc22582cf7 Merge branch 'PHP-5.6' into PHP-7.0 2016-09-24 18:05:21 +02:00
Christoph M. Becker
c596b02a5b Merge branch 'pull-request/2120' into PHP-5.6 2016-09-24 17:52:15 +02:00
Stanislav Malyshev
19866fb76c Fix various int size overflows.
Add function for detection of string zvals with length that does not fit
INT_MAX.
2016-09-12 21:04:23 -07:00
Christoph M. Becker
5880428dac Fix potential memory issue with USE_ZEND_ALLOC=0
The PHP core and extensions are written with the assumption that memory
allocation either succeeds, or the allocator bails out (i.e. the allocator
is infallible). Therefore the result of emalloc() and friends are not checked
for NULL values.

However, with USE_ZEND_ALLOC=0, malloc() and friends are used as allocators,
but these are fallible, i.e. they return NULL instead of bailing out if they
fail. This easily leads to invalid memory accesses in the following, such as
in <https://bugs.php.net/73032>. Some of these cases may constitute
exploitable vulnerabilities.

Therefore we make the infallible __zend_alloc() and friends the default for
USE_ZEND_ALLOC=0.
2016-09-07 22:50:53 +02:00
Xinchen Hui
ce6ad9bdd9 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: (48 commits)
  Update NEWs
  Unused label
  Fixed bug #72853 (stream_set_blocking doesn't work)
  fix test
  Bug #72663 - part 3
  Bug #72663 - part 2
  Bug #72663 - part 1
  Update NEWS
  BLock test with memory leak
  fix tests
  Fix TSRM build
  Fix bug #72850 - integer overflow in uuencode
  Fixed bug #72849 - integer overflow in urlencode
  Fix bug #72848 - integer overflow in quoted_printable_encode caused heap corruption
  Fix bug #72838 - 	Integer overflow lead to heap corruption in sql_regcase
  Fix bug #72837 - integer overflow in bzdecompress caused heap corruption
  Fix bug #72836 - integer overflow in base64_decode caused heap corruption
  Fix for bug #72807 - do not produce strings with negative length
  Fix for bug #72790 and bug #72799
  Fix bug #72730 - imagegammacorrect allows arbitrary write access
  ...

Conflicts:
	ext/standard/var_unserializer.c
2016-08-17 17:14:30 +08:00
Stanislav Malyshev
c2a13ced42 Fix bug #72742 - memory allocator fails to realloc small block to large one 2016-08-14 19:08:59 -07:00
Dmitry Stogov
0cfb47651c Fixed compilation warnings 2016-06-28 11:37:51 +03:00
Dmitry Stogov
ebb99a1a3a Fixed compilation warnings 2016-06-21 16:55:17 +03:00
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Nikita Popov
14023d39c1 Move builtin_ctzl portability into zend_bitset.h
Use this function in both zend_mm_bitset_find_one and
zend_bitset_first.

Maybe zend_bitset.h is not quite the right place for it, but I did
not want to include this in a globally included header like
zend_long.h or zend_portability.h.
2016-05-17 22:23:43 +02:00
Dmitry Stogov
a8d4649097 Use unsigned shift to clear the bit. 2016-04-29 12:38:48 +03:00
Rasmus Lerdorf
1efcdaf092 Disable huge pages in the Zend allocator by default
As per the discussion on internals, this is an expert feature
that needs special system-level configuration and care.
2016-03-22 08:04:53 -07:00
Dmitry Stogov
945a661912 Added ability to disable huge pages in Zend Memeory Manager through the environment variable USE_ZEND_ALLOC_HUGE_PAGES=0. 2016-03-17 22:43:42 +03:00
Anatol Belski
741bfe3932 fix build with clang on Winodws 2016-03-10 15:30:20 +01:00
Dmitry Stogov
0b9c87a02b Fixed bug #71535 (Integer overflow in zend_mm_alloc_heap()) 2016-02-24 11:04:48 +03:00
Xinchen Hui
97a9470d97 bump year which is missed in rev 49493a2 2016-01-02 17:56:11 +08:00
Xinchen Hui
3537e95dae bump year which is missed in rev 49493a2 2016-01-02 17:51:24 +08:00
Dmitry Stogov
59424bb7bd Fixed bug #71006 (symbol referencing errors on Sparc/Solaris) 2015-12-03 13:28:41 +03:00
Xinchen Hui
83de5364b7 manually apply the typo fix in master 2015-11-07 23:03:25 -08:00
Dmitry Stogov
eb32da13cd Fix frequent reallocations with many small strings 2015-10-27 17:07:58 +01:00
Dmitry Stogov
d949c3b6e5 Fixed incorrect "peak" memory consumption calculation. 2015-10-13 15:20:17 +03:00
Dmitry Stogov
04bcce3c15 Cleanup (we keep and reuse size from zend_mm_huge_list) 2015-09-22 15:51:02 +03:00
Dmitry Stogov
c61604b9a9 Fixed reporting about repeatable "huge" memory leaks. 2015-09-22 15:46:41 +03:00
Bob Weinand
08e253cdbc Optimize zend_mm_small_size_to_bin()
It removes a cmov operation and has a much faster branch for small allocations (especially when handling strings) (<= 64 bytes)
2015-09-19 23:07:43 +02:00
Dmitry Stogov
1b8bf059c4 Don't keep dangling pointer. 2015-09-10 20:03:42 +03:00
Dmitry Stogov
ac83eaef10 Don't inline "slow" and rarely used functions. 2015-09-09 13:42:35 +03:00
Dmitry Stogov
aa3fd8c849 Fixed typo that might cause serious bugs in MM. May be it was the reason of bug #70392 (SIGSEGV during PHP shutdown). 2015-09-08 17:22:26 +03:00
Dmitry Stogov
6848cb3f63 Use regular huge pages instead of anonymous if available. 2015-09-02 15:55:41 +03:00
Dmitry Stogov
111bd5d8c4 Introduced additional check. Its miss might be the reason of bug #70392 (SIGSEGV during PHP shutdown) 2015-09-02 13:05:12 +03:00
Dmitry Stogov
89aa1b7392 Ensure proper data alignment 2015-08-31 13:56:42 +03:00
Dmitry Stogov
87f0f77105 Simplified integer overflow checks 2015-08-28 12:47:21 +03:00
Dmitry Stogov
5d15d2b26d Removed useless signal protection 2015-08-28 12:39:18 +03:00
Bob Weinand
76e3e99dd6 Fix issues with phpdbg SIGINT handler
Also fix valgrind warnings in allocator when not using mmap()ed memory
2015-08-21 23:36:31 +01:00
Dmitry Stogov
71af54e5f6 Mark error and exception functions as "cold" (Matt's idea) 2015-08-19 14:40:56 +03:00
Dmitry Stogov
162bf9e802 Reimplemented ability to get debug info (C source file and line number) in phpdbg without hacks and ABI breaks. 2015-08-11 16:33:47 +03:00
Dmitry Stogov
668ecaa606 Fixed bug #70098 (Real memory usage doesn't decrease) 2015-08-04 18:21:05 +03:00
Dmitry Stogov
225bb70498 Added missing API functions 2015-07-09 12:19:30 +03:00