Skip to content

Instantly share code, notes, and snippets.

Avatar

Nikita Popov nikic

View GitHub Profile
View .diff
diff --git a/sapi/fuzzer/config.m4 b/sapi/fuzzer/config.m4
index 8e15a274ec..6d2339df1e 100644
--- a/sapi/fuzzer/config.m4
+++ b/sapi/fuzzer/config.m4
@@ -53,7 +53,7 @@ if test "$PHP_FUZZER" != "no"; then
dnl union, and this can't be easily fixed.
dnl We need to specify -fno-sanitize-recover=undefined here, otherwise ubsan warnings
dnl will not be considered failures by the fuzzer.
- CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize=object-size -fno-sanitize-recover=undefined"
+ CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize=object-size -fno-sanitize=alignment -fno-sanitize-recover=undefined"
View void
rackspace/php-opencloud/lib/OpenCloud/Common/Metadata.php:40
In method __set():
return $this->setProperty($property, $value);
kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php:989
In method __set():
return $this->_[HDOM_INFO_OUTER] = $value;
kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php:992
In method __set():
return $this->_[HDOM_INFO_TEXT] = $value;
kub-at/php-simple-html-dom-parser/src/KubAT/PhpSimple/lib/simple_html_dom.php:994
View constructor_void
/home/nikic/popular-package-analysis/sources/rackspace/php-opencloud/lib/OpenCloud/Database/Resource/Backup.php:60
return parent::__construct($service, $info);
/home/nikic/popular-package-analysis/sources/rackspace/php-opencloud/lib/OpenCloud/Database/Resource/User.php:75
return parent::__construct($instance->getService(), $info);
/home/nikic/popular-package-analysis/sources/rackspace/php-opencloud/lib/OpenCloud/Database/Resource/Instance.php:64
return parent::__construct($service, $info);
/home/nikic/popular-package-analysis/sources/rackspace/php-opencloud/lib/OpenCloud/Database/Resource/Database.php:45
return parent::__construct($instance->getService(), $info);
/home/nikic/popular-package-analysis/sources/rackspace/php-opencloud/lib/OpenCloud/Compute/Resource/Network.php:66
return parent::__construct($service, $id);
View diff_llvm_timings.php
<?php
// Extracting last timings as a convenience here,
// as we're usually interested in the last crate.
// We could also aggregate instead.
$metric = 'user_system';
$timings1 = parse_llvm_timing(extract_last_pass_timings(file_get_contents($argv[1])));
$timings2 = parse_llvm_timing(extract_last_pass_timings(file_get_contents($argv[2])));
$timings1 = array_column($timings1, null, 'name');
@nikic
nikic / shell_exec
Created Oct 7, 2019
Usage of shell exec operation in packagist top 2k
View shell_exec
/home/nikic/package-analysis/sources/globalcitizen/php-iban/utils/convert-registry.php:10
`iconv -f utf8 -t ascii --byte-subst="<0x%x>" --unicode-subst="<U+%04X>" 'IBAN_Registry.txt'`
/home/nikic/package-analysis/sources/johnpbloch/wordpress-core/wp-includes/ID3/getid3.lib.php:621
`$commandline`
/home/nikic/package-analysis/sources/johnpbloch/wordpress-core/wp-includes/ID3/getid3.lib.php:1416
`$commandline`
/home/nikic/package-analysis/sources/johnpbloch/wordpress-core/wp-includes/ID3/getid3.php:196
`$commandline`
/home/nikic/package-analysis/sources/johnpbloch/wordpress-core/wp-includes/ID3/getid3.php:1358
`$commandline`
@nikic
nikic / php.supp
Last active Jun 15, 2020
Valgrind suppression for for PHP
View php.supp
{
String_Equality_Intentionally_Reads_Uninit_Memory
Memcheck:Cond
fun:zend_string_equal_val
}
@nikic
nikic / php74_shim.h
Last active Apr 29, 2019
PHP 7.4 shim for the typed properties RFC
View php74_shim.h
#ifndef PHP74_SHIM_H
#define PHP74_SHIM_H
#if PHP_VERSION_ID < 70400
#define ZEND_TRY_ASSIGN_NULL(zv) do { \
ZVAL_DEREF(zv); \
zval_ptr_dtor(zv); \
ZVAL_NULL(zv); \
} while (0)
View validate_ascii.ll
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%struct.__loadu_si128 = type { <2 x i64> }
define i32 @validate_ascii(i8*, i64, i8*, i64*) #4 {
%5 = icmp ule i64 16, %1
br i1 %5, label %6, label %30
%7 = sub i64 %1, 16
View gc_compress.diff
diff --git a/Zend/zend_gc.c b/Zend/zend_gc.c
index 79c3470..f8fc6cd 100644
--- a/Zend/zend_gc.c
+++ b/Zend/zend_gc.c
@@ -126,16 +126,12 @@
#define GC_DEFAULT_BUF_SIZE (16 * 1024)
#define GC_BUF_GROW_STEP (128 * 1024)
-#define GC_COMPRESS_FACTOR 4096 /* shold be 0 to disable compression */
-#define GC_MAX_UNCOMPRESSED ((1024 * 1024) - GC_COMPRESS_FACTOR)
View mt_rand.c
// Resulting code as the diff is hard to read
static uint32_t rand_range32(uint32_t umax) {
uint32_t result, limit;
result = php_mt_rand();
/* Special case where no modulus is required */
if (UNEXPECTED(umax == UINT32_MAX)) {
return result;
You can’t perform that action at this time.