Sampling can lead to subtract with overflow #24

Closed
opened 2022-06-06 16:26:16 +02:00 by paul · 0 comments
Owner

A normal substraction should not have been used. It can panic now, while it should lead to a HTTP 404 or error feedback.
To reproduce use address "Berlin" and the pollen metric (http://localhost:3000/forecast?address=berlin&metrics=pollen)

Backtrace:

thread 'rocket-worker-thread' panicked at 'attempt to subtract with overflow', src/maps.rs:363:28
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: core::panicking::panic
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5
   3: sinoptik::maps::sample
             at ./src/maps.rs:363:28
   4: sinoptik::maps::Maps::pollen_samples
             at ./src/maps.rs:222:9
   5: sinoptik::providers::buienradar::get_pollen::{{closure}}::inner::{{closure}}
             at ./src/providers/buienradar.rs:174:5
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
   7: sinoptik::providers::buienradar::get_pollen::{{closure}}
             at ./src/providers/buienradar.rs:167:1
   8: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
   9: sinoptik::providers::buienradar::get_samples::{{closure}}
             at ./src/providers/buienradar.rs:209:60
  10: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
  11: sinoptik::forecast::forecast::{{closure}}
             at ./src/forecast.rs:197:100
  12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
  13: sinoptik::forecast_address::{{closure}}
             at ./src/lib.rs:93:60
A normal substraction should not have been used. It can panic now, while it should lead to a HTTP 404 or error feedback. To reproduce use address "Berlin" and the pollen metric (http://localhost:3000/forecast?address=berlin&metrics=pollen) Backtrace: ``` thread 'rocket-worker-thread' panicked at 'attempt to subtract with overflow', src/maps.rs:363:28 stack backtrace: 0: rust_begin_unwind at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5 1: core::panicking::panic_fmt at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14 2: core::panicking::panic at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5 3: sinoptik::maps::sample at ./src/maps.rs:363:28 4: sinoptik::maps::Maps::pollen_samples at ./src/maps.rs:222:9 5: sinoptik::providers::buienradar::get_pollen::{{closure}}::inner::{{closure}} at ./src/providers/buienradar.rs:174:5 6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19 7: sinoptik::providers::buienradar::get_pollen::{{closure}} at ./src/providers/buienradar.rs:167:1 8: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19 9: sinoptik::providers::buienradar::get_samples::{{closure}} at ./src/providers/buienradar.rs:209:60 10: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19 11: sinoptik::forecast::forecast::{{closure}} at ./src/forecast.rs:197:100 12: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19 13: sinoptik::forecast_address::{{closure}} at ./src/lib.rs:93:60 ```
paul added the
bug
label 2022-06-06 16:26:20 +02:00
paul self-assigned this 2022-06-06 16:26:23 +02:00
paul closed this issue 2022-06-06 19:51:15 +02:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: paul/sinoptik#24
No description provided.