Skip to content

Panic in GetObject on MinimumThroughputDownloadBody #1214

@trueb2

Description

@trueb2

Describe the bug

It looks like the length underflowed in the MinimumThroughputDownloadBody. On indexing, it panicked.

impl<const N: usize> LogBuffer<N> {
...
    /// Mutably returns the tail of the buffer.
    ///
    /// ## Panics
    ///
    /// The buffer MUST have at least one bin in it before this is called.
    fn tail_mut(&mut self) -> &mut Bin {
        debug_assert!(self.length > 0);
        &mut self.entries[self.length - 1]
    }

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Graceful erroring, no panicking.

Current Behavior

After much usage (month+ uptime) and many, many API calls, I notice the following panic.

thread 'actix-server worker 2' panicked at /Users/username/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-smithy-runtime-1.5.4/src/client/http/body/minimum_throughput/throughput.rs:199:14:
index out of bounds: the len is 10 but the index is 18446744073709551615
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: aws_smithy_runtime::client::http::body::minimum_throughput::http_body_0_4_x::<impl http_body::Body for aws_smithy_runtime::client::http::body::minimum_throughput::MinimumThroughputDownloadBody<B>>::poll_data
   4: <http_body::combinators::map_err::MapErr<B,F> as http_body::Body>::poll_data
   5: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
   6: aws_smithy_runtime::client::orchestrator::try_attempt::{{closure}}::{{closure}}
   7: <aws_smithy_async::future::timeout::Timeout<T,S> as core::future::future::Future>::poll
   8: <aws_smithy_runtime::client::timeout::MaybeTimeoutFuture<InnerFuture> as core::future::future::Future>::poll
   9: aws_smithy_runtime::client::orchestrator::try_op::{{closure}}::{{closure}}
  10: <aws_smithy_async::future::timeout::Timeout<T,S> as core::future::future::Future>::poll
  11: <aws_smithy_runtime::client::timeout::MaybeTimeoutFuture<InnerFuture> as core::future::future::Future>::poll
  12: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
  13: aws_smithy_runtime::client::orchestrator::invoke_with_stop_point::{{closure}}
  14: aws_sdk_s3::operation::get_object::builders::GetObjectFluentBuilder::send::{{closure}}
  15: asdfasdfasdf::get_object::{{closure}}::{{closure}}
  16: <tracing::instrument::Instrumented<T> as core::future::future::Future>::poll
  17: asdfasdfasdf::get_object::{{closure}}

I bumped in May and noticed this new panic recently.

-aws-config = { version = "1.1.3", features = ["behavior-version-latest"] }
-aws-sdk-s3 = "1.13.0"
+aws-config = { version = "1.4.0", features = ["behavior-version-latest"] }
+aws-sdk-s3 = "1.29.0"

Reproduction Steps

Same as #1133

Possible Solution

Prevent underflow and/or add checks for underflow.

Additional Information/Context

No response

Version

├── aws-config v1.5.0
│   ├── aws-credential-types v1.2.0
│   │   ├── aws-smithy-async v1.2.1
│   │   ├── aws-smithy-runtime-api v1.6.1
│   │   │   ├── aws-smithy-async v1.2.1 (*)
│   │   │   ├── aws-smithy-types v1.1.10
│   │   ├── aws-smithy-types v1.1.10 (*)
│   ├── aws-runtime v1.2.2
│   │   ├── aws-credential-types v1.2.0 (*)
│   │   ├── aws-sigv4 v1.2.1
│   │   │   ├── aws-credential-types v1.2.0 (*)
│   │   │   ├── aws-smithy-eventstream v0.60.4
│   │   │   │   ├── aws-smithy-types v1.1.10 (*)
│   │   │   ├── aws-smithy-http v0.60.8
│   │   │   │   ├── aws-smithy-eventstream v0.60.4 (*)
│   │   │   │   ├── aws-smithy-runtime-api v1.6.1 (*)
│   │   │   │   ├── aws-smithy-types v1.1.10 (*)
│   │   │   ├── aws-smithy-runtime-api v1.6.1 (*)
│   │   │   ├── aws-smithy-types v1.1.10 (*)
│   │   ├── aws-smithy-async v1.2.1 (*)
│   │   ├── aws-smithy-eventstream v0.60.4 (*)
│   │   ├── aws-smithy-http v0.60.8 (*)
│   │   ├── aws-smithy-runtime-api v1.6.1 (*)
│   │   ├── aws-smithy-types v1.1.10 (*)
│   │   ├── aws-types v1.3.0
│   │   │   ├── aws-credential-types v1.2.0 (*)
│   │   │   ├── aws-smithy-async v1.2.1 (*)
│   │   │   ├── aws-smithy-runtime-api v1.6.1 (*)
│   │   │   ├── aws-smithy-types v1.1.10 (*)
│   ├── aws-sdk-sso v1.26.0
│   │   ├── aws-credential-types v1.2.0 (*)
│   │   ├── aws-runtime v1.2.2 (*)
│   │   ├── aws-smithy-async v1.2.1 (*)
│   │   ├── aws-smithy-http v0.60.8 (*)
│   │   ├── aws-smithy-json v0.60.7
│   │   │   └── aws-smithy-types v1.1.10 (*)
│   │   ├── aws-smithy-runtime v1.5.4
│   │   │   ├── aws-smithy-async v1.2.1 (*)
│   │   │   ├── aws-smithy-http v0.60.8 (*)
│   │   │   ├── aws-smithy-runtime-api v1.6.1 (*)
│   │   │   ├── aws-smithy-types v1.1.10 (*)
│   │   ├── aws-smithy-runtime-api v1.6.1 (*)
│   │   ├── aws-smithy-types v1.1.10 (*)
│   │   ├── aws-types v1.3.0 (*)
│   ├── aws-sdk-ssooidc v1.27.0
│   │   ├── aws-credential-types v1.2.0 (*)
│   │   ├── aws-runtime v1.2.2 (*)
│   │   ├── aws-smithy-async v1.2.1 (*)
│   │   ├── aws-smithy-http v0.60.8 (*)
│   │   ├── aws-smithy-json v0.60.7 (*)
│   │   ├── aws-smithy-runtime v1.5.4 (*)
│   │   ├── aws-smithy-runtime-api v1.6.1 (*)
│   │   ├── aws-smithy-types v1.1.10 (*)
│   │   ├── aws-types v1.3.0 (*)
│   ├── aws-sdk-sts v1.26.0
│   │   ├── aws-credential-types v1.2.0 (*)
│   │   ├── aws-runtime v1.2.2 (*)
│   │   ├── aws-smithy-async v1.2.1 (*)
│   │   ├── aws-smithy-http v0.60.8 (*)
│   │   ├── aws-smithy-json v0.60.7 (*)
│   │   ├── aws-smithy-query v0.60.7
│   │   │   ├── aws-smithy-types v1.1.10 (*)
│   │   ├── aws-smithy-runtime v1.5.4 (*)
│   │   ├── aws-smithy-runtime-api v1.6.1 (*)
│   │   ├── aws-smithy-types v1.1.10 (*)
│   │   ├── aws-smithy-xml v0.60.8
│   │   ├── aws-types v1.3.0 (*)
│   ├── aws-smithy-async v1.2.1 (*)
│   ├── aws-smithy-http v0.60.8 (*)
│   ├── aws-smithy-json v0.60.7 (*)
│   ├── aws-smithy-runtime v1.5.4 (*)
│   ├── aws-smithy-runtime-api v1.6.1 (*)
│   ├── aws-smithy-types v1.1.10 (*)
│   ├── aws-types v1.3.0 (*)
├── aws-sdk-s3 v1.30.0
│   ├── aws-credential-types v1.2.0 (*)
│   ├── aws-runtime v1.2.2 (*)
│   ├── aws-sigv4 v1.2.1 (*)
│   ├── aws-smithy-async v1.2.1 (*)
│   ├── aws-smithy-checksums v0.60.8
│   │   ├── aws-smithy-http v0.60.8 (*)
│   │   ├── aws-smithy-types v1.1.10 (*)
│   ├── aws-smithy-eventstream v0.60.4 (*)
│   ├── aws-smithy-http v0.60.8 (*)
│   ├── aws-smithy-json v0.60.7 (*)
│   ├── aws-smithy-runtime v1.5.4 (*)
│   ├── aws-smithy-runtime-api v1.6.1 (*)
│   ├── aws-smithy-types v1.1.10 (*)
│   ├── aws-smithy-xml v0.60.8 (*)
│   ├── aws-types v1.3.0 (*)
│   ├── aws-config v1.5.0 (*)
│   ├── aws-sdk-s3 v1.30.0 (*)


### Environment details (OS name and version, etc.)

macOS 12.6

### Logs

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.p2This is a standard priority issueresponse-requestedWaiting on additional info and feedback. Will move to 'closing-soon' in 7 days.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions