Skip to content

reject dictionary lines whose only quote is the last char - #2272

Open
Medios-lgtm wants to merge 1 commit into
google:mainfrom
Medios-lgtm:afl-dict-closing-quote
Open

Medios-lgtm wants to merge 1 commit into
google:mainfrom
Medios-lgtm:afl-dict-closing-quote

Conversation

@Medios-lgtm

Copy link
Copy Markdown

ParseAFLDictionary only rejects a missing closing quote when stop == start, but when the opening quote is the last character of a line (e.g. kw=" in a --dictionary file) stop ends at start - 1, so stop - start wraps to SIZE_MAX and StrReplaceAll scans past the line buffer before throwing an uncaught std::length_error; checking stop <= start rejects it like the other malformed lines.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request fixes a potential out-of-bounds or invalid string_view creation in ParseAFLDictionary by updating the boundary check from stop == start to stop <= start. It also adds corresponding unit tests to verify the behavior with invalid inputs containing single or misplaced double quotes. There are no review comments to address, so no additional feedback is provided.

This branch has not been deployed

No deployments
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.

1 participant