-
Notifications
You must be signed in to change notification settings - Fork 51
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
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. |
There are commented out test cases for other invalid canonical json that we don't currently detect. |
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
' ' (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.
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
No description provided.