php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #57244 Output unusable without translated jump addresses
Submitted: 2006-09-15 11:51 UTC Modified: 2009-10-18 08:54 UTC
From: messias at gmail dot com Assigned:
Status: No Feedback Package: parsekit (PECL)
PHP Version: 5.1.6 OS: Debian i386/libc6 2.3.6/gcc 4.1
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-09-15 11:51 UTC] messias at gmail dot com
Description:
------------
Output should contain addresses of opcodes for jump destination. Either absolute address of every opcode or base address plus relative offsets would be nice. Output is otherwise completely unusable in PHP scripting environment.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-15 11:54 UTC] messias at gmail dot com
Something like this:

--- parsekit-1.1/parsekit.c
+++ parsekit-1.1.new/parsekit.c
@@ -75,9 +75,9 @@ static void php_parsekit_parse_node(zval
 #endif
 	} else {
 		/* IS_VAR || IS_TMP_VAR || IS_UNUSED */
-		char sop[(sizeof(void *) * 2) + 1];
+		char sop[(sizeof(void *) * 2) + 3];
 
-		snprintf(sop, (sizeof(void *) * 2) + 1, "%X", (unsigned int)node->u.var); 
+		snprintf(sop, (sizeof(void *) * 2) + 3, "0x%X", (unsigned int)node->u.var); 
 
 		if ((flags & PHP_PARSEKIT_VAR) ||
 			(options & PHP_PARSEKIT_ALL_ELEMENTS)) {
@@ -125,12 +125,16 @@ static void php_parsekit_parse_op(zval *
 {
 	zval *result, *op1, *op2;
 	long flags = 0;
+	char opcode_addr[(sizeof(void *) * 2) + 3];
+
+	snprintf(opcode_addr, (sizeof(void *) * 2) + 3, "0x%X", (unsigned int)op); 
 
 	array_init(return_value);
 
 	/* op->handler */
 	add_assoc_long(return_value, "opcode", op->opcode);
 	add_assoc_string(return_value, "opcode_name", php_parsekit_define_name_ex(op->opcode, php_parsekit_opcode_names, &flags, PHP_PARSEKIT_OPCODE_UNKNOWN) , 1);
+	add_assoc_string(return_value, "opcode_addr", opcode_addr, 1);
 	add_assoc_long(return_value, "flags", flags);
 
 	/* args: result, op1, op2 */
 [2008-11-12 09:40 UTC] sean@php.net
Hi,

I think this patch solves your problem; can you please let me know?

http://cvs.php.net/viewvc.cgi/pecl/parsekit/parsekit.c?r1=1.20&r2=1.21

S
 [2009-10-18 08:54 UTC] sean@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

Assuming this is fixed; please re-open if not.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 15:01:56 2024 UTC