Skip to content

Item with prefix causes out of range exception#53425

Merged
dibarbet merged 1 commit intodotnet:mainfrom
nohwnd:fix-substring-on-prefix
May 14, 2021
Merged

Item with prefix causes out of range exception#53425
dibarbet merged 1 commit intodotnet:mainfrom
nohwnd:fix-substring-on-prefix

Conversation

@nohwnd
Copy link
Member

@nohwnd nohwnd commented May 14, 2021

A bug was introduced here https://github.com/dotnet/roslyn/pull/53279/files#diff-f3fdd4b27af7f22c725fec19321e1c0e1b66e4ea9e66b9ce1218b8574605b78cR109 which causes out of range exception on any item with a prefix because the length of the prefix is not subtracted from the overall length.

image

(byte) has prefix ( and only the length of byte) should be taken, not the length of (byte)

@nohwnd nohwnd requested a review from dibarbet May 14, 2021 15:04
@nohwnd nohwnd requested a review from a team as a code owner May 14, 2021 15:04
@ghost ghost added the Area-IDE label May 14, 2021
@nohwnd nohwnd changed the title item with prefix causes out of range Item with prefix causes out of range exception May 14, 2021
@CyrusNajmabadi
Copy link
Contributor

@dibarbet can you take a look? A test sounds also be good here

Copy link
Member

@dibarbet dibarbet left a comment

Choose a reason for hiding this comment

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

🤦 good catch

I will approve this PR so we can get the fix merged before Monday, I'll followup today with a few more test cases for this.

dibarbet added a commit to dibarbet/roslyn that referenced this pull request May 14, 2021
@dibarbet
Copy link
Member

Merging this PR, added a test in #53428

@dibarbet dibarbet merged commit 9124d3a into dotnet:main May 14, 2021
@ghost ghost added this to the Next milestone May 14, 2021
@RikkiGibson RikkiGibson modified the milestones: Next, 17.0.P2 Jun 29, 2021
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.

4 participants