File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change 8
8
- Add flags context to event schema. ([ #4458 ] ( https://github.com/getsentry/relay/pull/4458 ) )
9
9
- Add support for view hierarchy attachment scrubbing. ([ #4452 ] ( https://github.com/getsentry/relay/pull/4452 ) )
10
10
11
+ ** Bug Fixes** :
12
+
13
+ - Fix a bug where parsing large unsigned integers would fail incorrectly. ([ #4472 ] ( https://github.com/getsentry/relay/pull/4472 ) )
14
+
11
15
** Internal** :
12
16
13
17
- Add data categories for LogItem and LogByte. ([ #4455 ] ( https://github.com/getsentry/relay/pull/4455 ) )
Original file line number Diff line number Diff line change @@ -265,12 +265,10 @@ impl<'de> Deserialize<'de> for Value {
265
265
266
266
#[ inline]
267
267
fn visit_u64 < E > ( self , value : u64 ) -> Result < Value , E > {
268
- let signed_value = value as i64 ;
269
- if signed_value as u64 == value {
270
- Ok ( Value :: I64 ( signed_value) )
271
- } else {
272
- Ok ( Value :: U64 ( value) )
273
- }
268
+ Ok ( value
269
+ . try_into ( )
270
+ . map ( Value :: I64 )
271
+ . unwrap_or ( Value :: U64 ( value) ) )
274
272
}
275
273
276
274
#[ inline]
@@ -504,3 +502,17 @@ impl PartialEq for Val<'_> {
504
502
}
505
503
}
506
504
}
505
+
506
+ #[ cfg( test) ]
507
+ mod tests {
508
+ use super :: * ;
509
+
510
+ #[ test]
511
+ fn test_unsigned_signed ( ) {
512
+ let v: Value = serde_json:: from_str ( "9223372036854775816" ) . unwrap ( ) ;
513
+ assert_eq ! ( v, Value :: U64 ( 9223372036854775816 ) ) ;
514
+
515
+ let v: Value = serde_json:: from_str ( "123" ) . unwrap ( ) ;
516
+ assert_eq ! ( v, Value :: I64 ( 123 ) ) ;
517
+ }
518
+ }
You can’t perform that action at this time.
0 commit comments