Handle negative zero and exponential numbers in Canonical JSON verification#424
Merged
Handle negative zero and exponential numbers in Canonical JSON verification#424
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #424 +/- ##
==========================================
+ Coverage 58.99% 59.09% +0.10%
==========================================
Files 51 51
Lines 7113 7124 +11
==========================================
+ Hits 4196 4210 +14
+ Misses 2528 2526 -2
+ Partials 389 388 -1 ☔ View full report in Codecov by Sentry. |
Contributor
Author
|
There are commented out test cases for other invalid canonical json that we don't currently detect. |
S7evinK
approved these changes
Dec 12, 2023
| got := string(bytes) | ||
| if got != want { | ||
| t.Errorf("CompactJSON(%q):\n want: %q\n got: %q", input, want, got) | ||
| t.Errorf("CompactJSON(%q):\n want: %q\n got: %q\n bytes: % X", input, want, got, bytes) |
Collaborator
There was a problem hiding this comment.
Suggested change
| t.Errorf("CompactJSON(%q):\n want: %q\n got: %q\n bytes: % X", input, want, got, bytes) | |
| t.Errorf("CompactJSON(%q):\n want: %q\n got: %q\n bytes: %x", input, want, got, bytes) |
I assume? (with the recent lower-/uppercase thing?)
Collaborator
There was a problem hiding this comment.
' ' (space) leave a space for elided sign in numbers (% d);
put spaces between bytes printing strings or slices in hex (% x, % X)
So this is fine.
devonh
pushed a commit
to matrix-org/dendrite
that referenced
this pull request
Jan 15, 2024
If I didn't miss anything, this should add fixes from: matrix-org/gomatrixserverlib#424 matrix-org/gomatrixserverlib#426 matrix-org/gomatrixserverlib#427 matrix-org/gomatrixserverlib#428 matrix-org/gomatrixserverlib#429 matrix-org/gomatrixserverlib#430
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.