Browse Source

disassembler: DECLARE_INHERITED_CLASS/DELAYED class not found

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@714 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 11 years ago
parent
commit
da9771ebf9
  1. 1
      ChangeLog
  2. 13
      Decompiler.class.php
  3. 2
      NEWS
  4. 11
      const_string_opcodes_php6.x.h
  5. 13
      disassembler.c

1
ChangeLog

@ -11,6 +11,7 @@ ChangeLog
1.3.2 2011-??-??
========
* disassembler: DECLARE_INHERITED_CLASS/DELAYED class not found
* disassembler: don't dump builtin functions
* fix win32 build against win32 native gnu tools
* compatibility fix: fix segv on shutdown when ionCube Loader is loaded

13
Decompiler.class.php

@ -1072,15 +1072,17 @@ class Decompiler
break;
// }}}
case XC_DECLARE_CLASS:
case XC_DECLARE_INHERITED_CLASS: // {{{
case XC_DECLARE_INHERITED_CLASS:
case XC_DECLARE_INHERITED_CLASS_DELAYED: // {{{
$key = $op1['u.constant'];
$class = &$this->dc['class_table'][$key];
if (!isset($class)) {
echo 'class not found: ' . $key;
if (!isset($this->dc['class_table'][$key])) {
echo 'class not found: ', $key, 'existing classes are:', "\n";
var_dump(array_keys($this->dc['class_table']));
exit;
}
$class = &$this->dc['class_table'][$key];
$class['name'] = $this->unquoteName($this->getOpVal($op2, $EX));
if ($opc == XC_DECLARE_INHERITED_CLASS) {
if ($opc == XC_DECLARE_INHERITED_CLASS || $opc == XC_DECLARE_INHERITED_CLASS_DELAYED) {
$ext /= XC_SIZEOF_TEMP_VARIABLE;
$class['parent'] = $T[$ext];
unset($T[$ext]);
@ -1866,6 +1868,7 @@ foreach (array (
'XC_VERIFY_ABSTRACT_CLASS' => -1,
'XC_DECLARE_CLASS' => -1,
'XC_DECLARE_INHERITED_CLASS' => -1,
'XC_DECLARE_INHERITED_CLASS_DELAYED' => -1,
'XC_ADD_INTERFACE' => -1,
'XC_POST_DEC_OBJ' => -1,
'XC_POST_INC_OBJ' => -1,

2
NEWS

@ -3,6 +3,8 @@
1.3.2 2011-??-??
========
* memory leak on recompile
* disassembler fixes and updates for new PHP
* win32 build fix
* improve compatibility with ionCube Loader

11
const_string_opcodes_php6.x.h

@ -1,4 +1,4 @@
/* size = 154 */
/* size = 157 */
static const char *const xc_opcode_names[] = {
/* 0 */ "NOP",
/* 1 */ "ADD",
@ -111,7 +111,7 @@ static const char *const xc_opcode_names[] = {
/* 108 */ "THROW",
/* 109 */ "FETCH_CLASS",
/* 110 */ "CLONE",
/* 111 */ "UNDEF",
/* 111 */ "RETURN_BY_REF",
/* 112 */ "INIT_METHOD_CALL",
/* 113 */ "INIT_STATIC_METHOD_CALL",
/* 114 */ "ISSET_ISEMPTY_VAR",
@ -151,7 +151,10 @@ static const char *const xc_opcode_names[] = {
/* 148 */ "ISSET_ISEMPTY_PROP_OBJ",
/* 149 */ "HANDLE_EXCEPTION",
/* 150 */ "USER_OPCODE",
/* 151 */ "U_NORMALIZE",
/* 151 */ "UNDEF",
/* 152 */ "JMP_SET",
/* 153 */ "DECLARE_LAMBDA_FUNCTION"
/* 153 */ "DECLARE_LAMBDA_FUNCTION",
/* 154 */ "ADD_TRAIT",
/* 155 */ "BIND_TRAITS",
/* 156 */ "SEPARATE"
};

13
disassembler.c

@ -22,7 +22,6 @@ static void xc_dasm(xc_sandbox_t *sandbox, zval *dst, zend_op_array *op_array TS
xc_compile_result_t cr;
int bufsize = 2;
char *buf;
int keysize;
xc_compile_result_init_cur(&cr, op_array TSRMLS_CC);
@ -45,7 +44,7 @@ static void xc_dasm(xc_sandbox_t *sandbox, zval *dst, zend_op_array *op_array TS
array_init(zv);
xc_dasm_zend_function(zv, b->pData TSRMLS_CC);
add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), b->arKey, b->nKeyLength, zv);
add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), ZSTR(BUCKET_KEY_S(b)), b->nKeyLength, zv);
}
add_assoc_zval_ex(dst, ZEND_STRS("function_table"), list);
@ -54,6 +53,8 @@ static void xc_dasm(xc_sandbox_t *sandbox, zval *dst, zend_op_array *op_array TS
array_init(list);
b = TG(internal_class_tail) ? TG(internal_class_tail)->pListNext : TG(class_table).pListHead;
for (; b; b = b->pListNext) {
int keysize, keyLength;
ALLOC_INIT_ZVAL(zv);
array_init(zv);
xc_dasm_zend_class_entry(zv, CestToCePtr(*(xc_cest_t *)b->pData) TSRMLS_CC);
@ -67,20 +68,20 @@ static void xc_dasm(xc_sandbox_t *sandbox, zval *dst, zend_op_array *op_array TS
}
memcpy(buf, BUCKET_KEY_S(b), keysize);
buf[keysize - 2] = buf[keysize - 1] = ""[0];
keysize = b->nKeyLength;
keyLength = b->nKeyLength;
#ifdef IS_UNICODE
if (BUCKET_KEY_TYPE(b) == IS_UNICODE) {
if (buf[0] == ""[0] && buf[1] == ""[0]) {
keysize ++;
keyLength ++;
}
} else
#endif
{
if (buf[0] == ""[0]) {
keysize ++;
keyLength ++;
}
}
add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), ZSTR(buf), b->nKeyLength, zv);
add_u_assoc_zval_ex(list, BUCKET_KEY_TYPE(b), ZSTR(buf), keyLength, zv);
}
efree(buf);
add_assoc_zval_ex(dst, ZEND_STRS("class_table"), list);

Loading…
Cancel
Save