Skip to content

Fix index out of bounds panic - #25

Open
thebaer wants to merge 1 commit into
elliotchance:masterfrom
writeas:fix-decode-string-panic
Open

Fix index out of bounds panic#25
thebaer wants to merge 1 commit into
elliotchance:masterfrom
writeas:fix-decode-string-panic

Conversation

@thebaer

@thebaer thebaer commented Oct 19, 2021

Copy link
Copy Markdown

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
Copy Markdown
Owner

Can you provide a test that was causing this panic?

@thebaer

thebaer commented Oct 20, 2021

Copy link
Copy Markdown
Author

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
Copy Markdown
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