Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ extern "C++" {

#ifdef ZEND_WIN32
#define ZEND_SECURE_ZERO(var, size) RtlSecureZeroMemory((var), (size))
#elif defined(HAVE_MEMSET_EXPLICIT)
#define ZEND_SECURE_ZERO(var, size) memset_explicit((var), 0, (size))
#else
#define ZEND_SECURE_ZERO(var, size) explicit_bzero((var), (size))
#endif
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ AC_CHECK_FUNCS(m4_normalize([
memmem
mempcpy
memrchr
memset_explicit
mkstemp
mmap
nice
Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/zend_accelerator_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ ZEND_INI_BEGIN()
STD_PHP_INI_ENTRY("opcache.jit_max_root_traces" , "1024", PHP_INI_SYSTEM, OnUpdateLong, max_root_traces, zend_jit_globals, jit_globals)
STD_PHP_INI_ENTRY("opcache.jit_max_side_traces" , "128", PHP_INI_SYSTEM, OnUpdateLong, max_side_traces, zend_jit_globals, jit_globals)
STD_PHP_INI_ENTRY("opcache.jit_max_exit_counters" , "8192", PHP_INI_SYSTEM, OnUpdateLong, max_exit_counters, zend_jit_globals, jit_globals)
/* Defautl value should be a prime number, to reduce the chances of loop iterations being a factor of opcache.jit_hot_loop */
/* Default value should be a prime number, to reduce the chances of loop iterations being a factor of opcache.jit_hot_loop */
STD_PHP_INI_ENTRY("opcache.jit_hot_loop" , "61", PHP_INI_SYSTEM, OnUpdateCounter, hot_loop, zend_jit_globals, jit_globals)
STD_PHP_INI_ENTRY("opcache.jit_hot_func" , "127", PHP_INI_SYSTEM, OnUpdateCounter, hot_func, zend_jit_globals, jit_globals)
STD_PHP_INI_ENTRY("opcache.jit_hot_return" , "8", PHP_INI_SYSTEM, OnUpdateCounter, hot_return, zend_jit_globals, jit_globals)
Expand Down
6 changes: 3 additions & 3 deletions ext/sqlite3/tests/sqlite3_explain.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ array(%d) {
["addr"]=>
int(1)
["opcode"]=>
string(13) "InitCoroutine"
string(%d) "%s"
["p1"]=>
int(3)
["p2"]=>
int(%d)
["p3"]=>
int(2)
["p4"]=>
NULL
%s
["p5"]=>
int(0)
["comment"]=>
Expand Down Expand Up @@ -368,7 +368,7 @@ array(1) {
["parent"]=>
int(0)
["notused"]=>
int(0)
int(%d)
["detail"]=>
string(17) "SCAN test_explain"
}
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ PHP_FUNCTION(pack)
switch (code) {
case 'h':
case 'H':
INC_OUTPUTPOS((arg + (arg % 2)) / 2,1) /* 4 bit per arg */
INC_OUTPUTPOS((arg / 2) + (arg % 2),1) /* 4 bit per arg */
break;

case 'a':
Expand Down
14 changes: 14 additions & 0 deletions ext/standard/tests/strings/gh18976.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
--TEST--
GH-18976 (pack overflow with h/H format)
--INI--
memory_limit=-1
--FILE--
<?php
pack('h2147483647', 1);
pack('H2147483647', 1);
?>
--EXPECTF--

Warning: pack(): Type h: not enough characters in string in %s on line %d

Warning: pack(): Type H: not enough characters in string in %s on line %d
6 changes: 4 additions & 2 deletions main/explicit_bzero.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@

PHPAPI void php_explicit_bzero(void *dst, size_t siz)
{
#ifdef HAVE_EXPLICIT_MEMSET
explicit_memset(dst, 0, siz);
#ifdef HAVE_MEMSET_EXPLICIT /* C23 */
memset_explicit(dst, 0, siz);
#elif defined(HAVE_EXPLICIT_MEMSET) /* NetBSD-specific */
explicit_memset(dst, 0, siz);
#elif defined(PHP_WIN32)
RtlSecureZeroMemory(dst, siz);
#elif defined(__GNUC__)
Expand Down