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: FormatString.Interpret() #4617

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AlaRduTP
Copy link

@AlaRduTP AlaRduTP commented May 4, 2024

This should fix #4616 .

I provide position + max_str_len as an extra argument named default to SmartFindMixin.find(). This enables us to check if a newline is present. If one is found, the value of default gets replaced by the newline's index.

if cases and cases[-1][0].is_true():
default = cases.pop(-1)[1]

@AlaRduTP AlaRduTP changed the title Fix: FormatString.Interpret Fix: FormatString.Interpret() May 4, 2024
@mborgerson
Copy link
Member

Thanks for the PR. Will you please also add a test case that covers the original issue?

@AlaRduTP
Copy link
Author

Hi @mborgerson, I've added the test case.

Also, another PR with a new binary for this test is opened.

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.

The FormatString interpreter incorrectly calculates the length of the string to be read.
2 participants