Skip to content

Conversation

@Metabolix
Copy link
Contributor

Fix base64_decode bugs 72264, 72263, 72152, with tests.

This is for PHP-7.0, because the patches don't cleanly apply to PHP-5.6 (which uses char* instead of zend_string).

Metabolix added 6 commits May 25, 2016 22:51
If length == 0 || *current != '=' is false, the for loop will always
end up in this same point, until the if statement becomes true.
Thus, the if statement is not needed.
This added check is actually for NOT failing in NON-strict mode.
The ch == -2 check later causes the desired failure in strict mode.
case 1 is already handled in the first lines of the for loop;
it would only be entered in the invalid case where the string
continues past the defined length (ch != 0 but length-- == 0).

case 2 and case 3 are redundant, since k >= j and later the
string is truncated to j characters anyway.
@laruence laruence added the Bug label May 28, 2016
@Metabolix
Copy link
Contributor Author

Any comments on this? Is there something wrong with the patches?

@nikic
Copy link
Member

nikic commented Jul 1, 2016

I don't think anything's wrong. I'll try to land this on the next week.

@nikic
Copy link
Member

nikic commented Jul 5, 2016

Merged into 7.0 and upwards. Thanks for your thorough work on this!

I think that the FIXME "why do we still allow invalid padding in other places in the middle of the string?" at least should be resolved as well. Padding in the middle of the string really makes no sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants