Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Applying zero offset to null pointer in zend_hash.c #13833

Closed
@YuanchengJiang

Description

@YuanchengJiang

Description

Run the following test code (phpt):

--TEST--Applying zero offset to null pointer in zend_hash.c--INI--phar.require_hash=0phar.readonly=0--FILE--<?php$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';$pname = 'phar://' . $fname;$file = "<?phpPhar::mapPhar('hio');__HALT_COMPILER(); ?>";$files = array();$files['a'] = 'a';include 'files/phar_test.inc';include $fname;echo file_get_contents('phar://hio/a');$fname = __DIR__ . '/' . basename(__FILE__, '.php') . '.phar.php';$pname = 'phar://' . $fname;$file = "<?php __HALT_COMPILER(); ?>";$files = array();$files['a'] = array('cont' => 'a');include 'files/phar_test.inc';foreach($files as $name => $cont) {    var_dump(file_get_contents($pname.'/'.$name));}$phar = new Phar($fname);var_dump($phar->getMetadata());$phar->setMetadata((object) ['my' => 'friend']);unset($phar);// NOTE: Phar will use the cached value of metadata if setMetaData was called on that Phar path before.// Save the writes to the phar and use a different file path.$fname_new = "$fname.copy.php";copy($fname, $fname_new);$phar = new Phar($fname_new);var_dump($phar->getMetadata());?>--EXTENSIONS--phar--CLEAN--<?php unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?><?phpunlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php');unlink(__DIR__ . '/' . basename(__FILE__, '.clean.php') . '.phar.php.copy.php');?>--CREDITS--Yuancheng Jiang <yuancheng@comp.nus.edu.sg>Felix De Vliegher <felix.devliegher@gmail.com>--EXPECT--aint(0)RegexIterator::setMode(): Argument #1 ($mode) must be RegexIterator::MATCH, RegexIterator::GET_MATCH, RegexIterator::ALL_MATCHES, RegexIterator::SPLIT, or RegexIterator::REPLACEint(0)string(1) "a"NULLobject(stdClass)#2 (1) {  ["my"]=>  string(6) "friend"}

phar_test.inc:https://github.com/php/php-src/blob/master/ext/phar/tests/files/phar_test.inc

Resulted in this output:

/php-src/Zend/zend_hash.c:1800:2: runtime error: applying zero offset to null pointerSUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /php-src/Zend/zend_hash.c:1800:2 in

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp