[NRBF] Reject orphaned records and invalid references#103632
Closed
adamsitnik wants to merge 8 commits intodotnet:mainfrom
Closed
[NRBF] Reject orphaned records and invalid references#103632adamsitnik wants to merge 8 commits intodotnet:mainfrom
adamsitnik wants to merge 8 commits intodotnet:mainfrom
Conversation
adamsitnik
commented
Jun 18, 2024
| { | ||
| record = memberReference.GetReferencedRecord(); | ||
|
|
||
| if (record is not BinaryObjectStringRecord) |
Member
Author
There was a problem hiding this comment.
this check is no longer needed here, as there is a universal check for all references in RecordMap.Add. The benefit is that we throw as soon as we encounter an invalid reference.
This was referenced Jun 18, 2024
Open
# Conflicts: # src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/SerializationRecordId.cs
# Conflicts: # src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/NrbfDecoder.cs # src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/Utils/ThrowHelper.cs
Member
|
We are going to discuss this further to decide if we want to change this logic in .NET 9 or document that the decoder does not reject these records. We could potentially add this logic in .NET 10 with the This is therefore not blocking the release. |
# Conflicts: # src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/MemberReferenceRecord.cs # src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/NrbfDecoder.cs # src/libraries/System.Formats.Nrbf/src/System/Formats/Nrbf/RecordMap.cs # src/libraries/System.Formats.Nrbf/tests/InvalidInputTests.cs # src/libraries/System.Formats.Nrbf/tests/System.Formats.Nrbf.Tests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A brief explanation of how I've implemented it:
RootId, but nothing else (its type etc).BinaryLibraryRecordat any point.ClassRecordwith any members orArrayRecordwith any items, a stack is being populated with information of expected record type. We read those records and if there is a type mismatch, we throw.@GrabYourPitchforks PTAL and let me know if you have any concerns. I would be happy to convert specific scenarios into test cases.