Guest User

Untitled

a guest
Jan 22nd, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. for offset in (0..64 * 1024 * 1024).step_by(8) { } == for i in range( 0, 64*1024*1024, 8):
  2.  
  3. Reading Raw Bytes: let strr = unsafe{ std::slice::from_raw_parts(straddr as *const u8, 0x10) } ;
  4. let redone = String::from_utf8_lossy(&strr);
  5.  
  6. What a string looks like in memory:
  7. ```
  8. /// waht a string actuallly looks like:
  9. $2 = alloc::string::String {
  10. vec: alloc::vec::Vec<u8> {
  11. buf: alloc::raw_vec::RawVec<u8, alloc::alloc::Global> {
  12. ptr: core::ptr::Unique<u8> {
  13. pointer: 0x5555555acde0 "29\n\000",
  14. _marker: core::marker::PhantomData<u8>
  15. },
  16. cap: 0x3,
  17. a: alloc::alloc::Global
  18. },
  19. len: 0x3
  20. }
  21. }
  22. */
  23. ```
  24.  
  25. ```
  26. //std::slice::from_raw_parts(0x1337 as *const u8, 0x20 )
  27. /*
  28. // as long as we never deref the var it never crashes...
  29. $1 = &[u8] {
  30. data_ptr: 0x1337 <error: Cannot access memory at address 0x1337>,
  31. length: 0x20
  32. }
  33. */
  34. ```
Add Comment
Please, Sign In to add comment