mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
fix: audit sqlx_postgres::types::array
for bad casts
This commit is contained in:
parent
bf13a7706b
commit
01186a062a
1 changed files with 8 additions and 1 deletions
|
@ -174,7 +174,14 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
buf.extend(&(self.len() as i32).to_be_bytes()); // len
|
||||
let array_len = i32::try_from(self.len()).map_err(|_| {
|
||||
format!(
|
||||
"encoded array length is too large for Postgres: {}",
|
||||
self.len()
|
||||
)
|
||||
})?;
|
||||
|
||||
buf.extend(array_len.to_be_bytes()); // len
|
||||
buf.extend(&1_i32.to_be_bytes()); // lower bound
|
||||
|
||||
for element in self.iter() {
|
||||
|
|
Loading…
Reference in a new issue