Skip to content
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

Add more buffer length checks #39

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [codec-0.9.2] - 2024-02-01

* Add more buffer length checks

## [1.0.2] - 2024-01-19

* SenderLink close notification
Expand Down
4 changes: 2 additions & 2 deletions codec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "ntex-amqp-codec"
version = "0.9.1"
version = "0.9.2"
description = "AMQP 1.0 Protocol Codec"
authors = ["Nikolay Kim <[email protected]>", "Max Gortman <[email protected]>", "Mike Yagley <[email protected]>"]
license = "MIT/Apache-2.0"
edition = "2018"

[dependencies]
ntex-bytes = "0.1.21"
ntex-bytes = "0.1.24"
ntex-codec = "0.6.2"
byteorder = "1.5"
fxhash = "0.2.1"
Expand Down
4 changes: 4 additions & 0 deletions codec/src/codec/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
{
fn decode_with_format(input: &mut Bytes, fmt: u8) -> Result<Self, AmqpParseError> {
let header = decode_map_header(input, fmt)?;
decode_check_len!(input, header.size as usize);
let mut map_input = input.split_to(header.size as usize);
let count = header.count / 2;
let mut map: collections::HashMap<K, V, S> =
Expand All @@ -267,6 +268,7 @@
impl<T: DecodeFormatted> DecodeFormatted for Vec<T> {
fn decode_with_format(input: &mut Bytes, fmt: u8) -> Result<Self, AmqpParseError> {
let header = decode_array_header(input, fmt)?;
decode_check_len!(input, 1);
let item_fmt = input[0]; // todo: support descriptor
input.split_to(1);
let mut result: Vec<T> = Vec::with_capacity(header.count as usize);
Expand All @@ -281,6 +283,7 @@
impl DecodeFormatted for VecSymbolMap {
fn decode_with_format(input: &mut Bytes, fmt: u8) -> Result<Self, AmqpParseError> {
let header = decode_map_header(input, fmt)?;
decode_check_len!(input, header.size as usize);
let mut map_input = input.split_to(header.size as usize);
let count = header.count / 2;
let mut map = Vec::with_capacity(count as usize);
Expand All @@ -297,6 +300,7 @@
impl DecodeFormatted for VecStringMap {
fn decode_with_format(input: &mut Bytes, fmt: u8) -> Result<Self, AmqpParseError> {
let header = decode_map_header(input, fmt)?;
decode_check_len!(input, header.size as usize);
let mut map_input = input.split_to(header.size as usize);
let count = header.count / 2;
let mut map = Vec::with_capacity(count as usize);
Expand Down Expand Up @@ -673,10 +677,10 @@
#[test]
fn test_timestamp() {
let mut b1 = BytesMut::with_capacity(0);
let datetime = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 680 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead
datetime.encode(&mut b1);

let expected = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 683 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead
assert_eq!(
expected,
unwrap_value(DateTime::<Utc>::decode(&mut b1.freeze()))
Expand All @@ -686,10 +690,10 @@
#[test]
fn test_timestamp_pre_unix() {
let mut b1 = BytesMut::with_capacity(0);
let datetime = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 693 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead
datetime.encode(&mut b1);

let expected = Utc.ymd(1968, 7, 26).and_hms_milli(18, 21, 3, 521);

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 696 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead
assert_eq!(
expected,
unwrap_value(DateTime::<Utc>::decode(&mut b1.freeze()))
Expand Down Expand Up @@ -745,7 +749,7 @@
#[test]
fn variant_timestamp() {
let mut b1 = BytesMut::with_capacity(0);
let datetime = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-apple-darwin

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / 1.75.0 - x86_64-unknown-linux-gnu

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / nightly - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead

Check warning on line 752 in codec/src/codec/decode.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-pc-windows-msvc

use of deprecated method `chrono::Date::<Tz>::and_hms_milli`: Use and_hms_milli_opt() instead
Variant::Timestamp(datetime).encode(&mut b1);

let expected = Utc.ymd(2011, 7, 26).and_hms_milli(18, 21, 3, 521);
Expand Down
2 changes: 1 addition & 1 deletion codec/src/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl Decoder for ProtocolIdCodec {
if src.len() < PROTOCOL_HEADER_LEN {
Ok(None)
} else {
let src = src.split_to(8);
let src = src.split_to(PROTOCOL_HEADER_LEN);
if &src[0..4] != PROTOCOL_HEADER_PREFIX {
Err(ProtocolIdError::InvalidHeader)
} else if &src[5..8] != PROTOCOL_VERSION {
Expand Down
Loading