diff --git a/src/integrations/serde.rs b/src/integrations/serde.rs index e73b3fa4..b871b1fc 100644 --- a/src/integrations/serde.rs +++ b/src/integrations/serde.rs @@ -67,14 +67,26 @@ impl<'de> de::Deserialize<'de> for InputValue { Ok(InputValue::boolean(value)) } - fn visit_i64(self, value: i64) -> Result { - Ok(InputValue::int(value)) + fn visit_i64(self, value: i64) -> Result + where E: de::Error, + { + if value >= i32::min_value() as i64 && value <= i32::max_value() as i64 { + Ok(InputValue::int(value)) + } + else { + Err(E::custom(format!("integer out of range"))) + } } fn visit_u64(self, value: u64) -> Result where E: de::Error, { - self.visit_f64(value as f64) + if value <= i32::max_value() as u64 { + self.visit_i64(value as i64) + } + else { + Err(E::custom(format!("integer out of range"))) + } } fn visit_f64(self, value: f64) -> Result {