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 with overflow panic when requested address + len is out of bounds #64

Open
ko1N opened this issue Jun 28, 2021 · 0 comments
Open

Add with overflow panic when requested address + len is out of bounds #64

ko1N opened this issue Jun 28, 2021 · 0 comments
Labels
bug Something isn't working
Projects

Comments

@ko1N
Copy link
Member

ko1N commented Jun 28, 2021

When reading at a high address with an appropriate length that would cause an overflow this panic is emitted. It would be better to not panic and just return a specialized Error.

thread '<unnamed>' panicked at 'attempt to add with overflow', memflow/src/types/address.rs:288:16
stack backtrace:
   0: rust_begin_unwind
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:50:5
   3: <memflow::types::address::Address as core::ops::arith::Add<usize>>::add
             at ./rs/src/memflow/memflow/src/types/address.rs:288:16
   4: <memflow::mem::cache::cached_vat::CachedVirtualTranslate<V,Q> as memflow::mem::virt_translate::VirtualTranslate>::virt_to_phys_iter::{{closure}}::{{closure}}
             at ./rs/src/memflow/memflow/src/mem/cache/cached_vat.rs:172:47
   5: <memflow::iter::page_chunks::PageChunkIterator<T,FS> as core::iter::traits::iterator::Iterator>::next
             at ./rs/src/memflow/memflow/src/iter/page_chunks.rs:211:39
   6: core::iter::traits::iterator::Iterator::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/traits/iterator.rs:2005:29
   7: <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::try_fold::flatten::{{closure}}
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/flatten.rs:305:25
   8: core::iter::adapters::map::map_try_fold::{{closure}}
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/map.rs:89:21
   9: core::iter::adapters::filter_map::filter_map_try_fold::{{closure}}
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/filter_map.rs:47:20
  10: core::iter::adapters::map::map_try_fold::{{closure}}
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/map.rs:89:21
  11: core::iter::traits::iterator::Iterator::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/traits/iterator.rs:2006:21
  12: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/map.rs:115:9
  13: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/filter_map.rs:77:9
  14: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/map.rs:115:9
  15: <core::iter::adapters::fuse::Fuse<I> as core::iter::adapters::fuse::FuseImpl<I>>::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/fuse.rs:448:9
  16: <core::iter::adapters::fuse::Fuse<I> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/fuse.rs:97:9
  17: <core::iter::adapters::flatten::FlattenCompat<I,U> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/flatten.rs:316:16
  18: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::try_fold
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/flatten.rs:66:9
  19: core::iter::traits::iterator::Iterator::find_map
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/traits/iterator.rs:2390:9
  20: <core::iter::adapters::filter_map::FilterMap<I,F> as core::iter::traits::iterator::Iterator>::next
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/filter_map.rs:61:9
  21: core::iter::adapters::peekable::Peekable<I>::peek::{{closure}}
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/peekable.rs:216:43
  22: core::option::Option<T>::get_or_insert_with
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/option.rs:933:26
  23: core::iter::adapters::peekable::Peekable<I>::peek
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/iter/adapters/peekable.rs:216:9
  24: <memflow::mem::cache::cached_vat::CachedVirtualTranslate<V,Q> as memflow::mem::virt_translate::VirtualTranslate>::virt_to_phys_iter
             at ./rs/src/memflow/memflow/src/mem/cache/cached_vat.rs:193:12
  25: <memflow::mem::virt_mem::virtual_dma::VirtualDMA<T,V,D> as memflow::mem::virt_mem::VirtualMemory>::virt_read_raw_list
             at ./rs/src/memflow/memflow/src/mem/virt_mem/virtual_dma.rs:167:9
  26: <P as memflow::mem::virt_mem::VirtualMemory>::virt_read_raw_list
             at ./rs/src/memflow/memflow/src/mem/virt_mem.rs:207:9
  27: memflow::mem::virt_mem::VirtualMemory::virt_read_raw_into
             at ./rs/src/memflow/memflow/src/mem/virt_mem.rs:68:9
  28: virt_read_raw_into
             at ./rs/src/memflow/memflow-ffi/src/mem/virt_mem.rs:73:5
  29: _ZN14CVirtualMemory18virt_read_raw_intoIJmPhmEEEiDpT_
             at ./rs/src/memflow/memflow-ffi/memflow_cpp.h:77:5
@ko1N ko1N added the bug Something isn't working label Jun 28, 2021
@ko1N ko1N added this to To do in Version 0.2 via automation Jun 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Version 0.2
  
To do
Development

No branches or pull requests

1 participant