-
Notifications
You must be signed in to change notification settings - Fork 29
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
Updated Apache-avro dependency #60
Conversation
Indeed, thanks ! |
The CI checks have failed! |
Interestingly 0.16 cannot parse this schema anymore: {
"type": "record",
"name": "DateLogicalType",
"fields": [ {
"name": "birthday",
"type": {"type": "int", "logicalType": "date"},
"default": 1681601653
} ]
} It says: However this one is fine: {
"type": "record",
"name": "DateLogicalType",
"fields": [ {
"name": "release_datetime_micro",
"type": {"type": "long", "logicalType": "timestamp-micros"},
"default": 1570903062000000
} ]
} @martin-g Do you know where I should report this ? |
https://issues.apache.org/jira/browse/AVRO |
diff --git i/lang/rust/avro/src/types.rs w/lang/rust/avro/src/types.rs
index 97d6b7174..8d9652d71 100644
--- i/lang/rust/avro/src/types.rs
+++ w/lang/rust/avro/src/types.rs
@@ -281,7 +281,14 @@ impl From<JsonValue> for Value {
match value {
JsonValue::Null => Self::Null,
JsonValue::Bool(b) => b.into(),
- JsonValue::Number(ref n) if n.is_i64() => Value::Long(n.as_i64().unwrap()),
+ JsonValue::Number(ref n) if n.is_i64() => {
+ let n = n.as_i64().unwrap();
+ if n >= i32::MIN as i64 && n <= i32::MAX as i64 {
+ Value::Int(n as i32)
+ } else {
+ Value::Long(n)
+ }
+ },
JsonValue::Number(ref n) if n.is_f64() => Value::Double(n.as_f64().unwrap()),
JsonValue::Number(n) => Value::Long(n.as_u64().unwrap() as i64), // TODO: Not so great
JsonValue::String(s) => s.into(), This fixes the problem, |
Thanks, I have asked for an account on the JIRA server to be able to create issues. |
Ok I created this issue: |
The fix is committed! |
Reference: https://rustsec.org/advisories/RUSTSEC-2023-0074
apache-avro. 0.16 doesn't have a dependency on zerocopy, and therefore avoids this security advisory