Skip to content

Fix heap corruption in zend_parse_arg_str - #1073

Closed
hikari-no-yume wants to merge 1 commit into
php:masterfrom
hikari-no-yume:zpp_str_fix
Closed

hikari-no-yume wants to merge 1 commit into
php:masterfrom
hikari-no-yume:zpp_str_fix

Conversation

@hikari-no-yume

Copy link
Copy Markdown
Contributor

Based on Anthony's patch for a bug he discovered. Bug was in the scalar type hints patch, but since it was in this function and @dstogov himself had reviewed the weakly-typed variant of that patch, I doubt it's a scalar type hints issue.

@hikari-no-yume

Copy link
Copy Markdown
Contributor Author

@dstogov does this look okay? It's your code, and I don't feel qualified to check this is completely correct.

Comment thread Zend/zend_API.h

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this change. This will convert it to string in a separate zval and that string will never get freed. We have to change the value that is on the VM stack to make sure that it will be freed when the function leaves, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Should probably be just convert_to_string(arg) then.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code looks right. This patch just can't work. I'll need to take a look into your branch.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, take the proper fix from my branch dstogov@66fd52c

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, thanks!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dstogov Merged fix into strict mode branch, thanks.

@hikari-no-yume
hikari-no-yume deleted the zpp_str_fix branch February 10, 2015 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants