Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix index out of bounds panic #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thebaer
Copy link

@thebaer thebaer commented Oct 19, 2021

Previously, DecodePHPString could panic on this line due to the index being out bounds:

switch data[i+1] {

This fixes that.


This change is Reviewable

@elliotchance
Copy link
Owner

Can you provide a test that was causing this panic?

@thebaer
Copy link
Author

thebaer commented Oct 20, 2021

Sure, I'll try to dig up the data that caused this. But you can also see from that line that it's possible for this to happen. Do you need that test in order to merge this?

@elliotchance
Copy link
Owner

Yes, if the last character is a \\ (which is a mangled input anyway?). However, if the last character is not it shouldn't be skipped. So the protection needs to be conditional as well.

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.

2 participants