File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
postgres-protocol/src/authentication Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ use base64::display::Base64Display;
4
4
use base64:: engine:: general_purpose:: STANDARD ;
5
5
use base64:: Engine ;
6
6
use hmac:: { Hmac , Mac } ;
7
- use rand:: { self , Rng } ;
7
+ use rand:: Rng ;
8
8
use sha2:: digest:: FixedOutput ;
9
9
use sha2:: { Digest , Sha256 } ;
10
10
use std:: fmt:: Write ;
Original file line number Diff line number Diff line change @@ -111,9 +111,11 @@ impl ToSql for DateTime<FixedOffset> {
111
111
impl < ' a > FromSql < ' a > for NaiveDate {
112
112
fn from_sql ( _: & Type , raw : & [ u8 ] ) -> Result < NaiveDate , Box < dyn Error + Sync + Send > > {
113
113
let jd = types:: date_from_sql ( raw) ?;
114
+ let jd = Duration :: try_days ( i64:: from ( jd) )
115
+ . ok_or_else ( || "value too large to decode" ) ?;
114
116
base ( )
115
117
. date ( )
116
- . checked_add_signed ( Duration :: days ( i64 :: from ( jd ) ) )
118
+ . checked_add_signed ( jd )
117
119
. ok_or_else ( || "value too large to decode" . into ( ) )
118
120
}
119
121
You can’t perform that action at this time.
0 commit comments