Skip to content

Instantly share code, notes, and snippets.

@Manishearth
Created December 29, 2016 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Manishearth/6a9367a7d8772e095629e82184f05ad4 to your computer and use it in GitHub Desktop.
Save Manishearth/6a9367a7d8772e095629e82184f05ad4 to your computer and use it in GitHub Desktop.
Unchecked indexing or unchecked utf8 conversion:
registry/src/github.com-1ecc6299db9ec823/cssparser-0.7.1
git/checkouts/rust-url-4933a72e57e0d4c1
registry/src/github.com-1ecc6299db9ec823/httparse-1.2.1
registry/src/github.com-1ecc6299db9ec823/idna-0.1.0
registry/src/github.com-1ecc6299db9ec823/inflate-0.1.1
registry/src/github.com-1ecc6299db9ec823/num-0.1.29
registry/src/github.com-1ecc6299db9ec823/nom-1.2.3
registry/src/github.com-1ecc6299db9ec823/pest-0.3.3
registry/src/github.com-1ecc6299db9ec823/quickersort-2.1.0
registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.16
registry/src/github.com-1ecc6299db9ec823/serde_json-0.8.4
registry/src/github.com-1ecc6299db9ec823/solicit-0.4.4
For performance
registry/src/github.com-1ecc6299db9ec823/aho-corasick-0.4.0 # memory maps (for performance)
registry/src/github.com-1ecc6299db9ec823/iron-hmac-0.3.3 # replicates an unstable library function
registry/src/github.com-1ecc6299db9ec823/itoa-0.1.1
registry/src/github.com-1ecc6299db9ec823/md5-0.2.1
registry/src/github.com-1ecc6299db9ec823/rand-0.3.12
registry/src/github.com-1ecc6299db9ec823/string_cache-0.2.27
registry/src/github.com-1ecc6299db9ec823/rust-crypto-0.2.34
registry/src/github.com-1ecc6299db9ec823/regex-0.1.44
For other reasons
registry/src/github.com-1ecc6299db9ec823/log-0.3.4 # Stepping around restrictions on statics, probably could use lazy_static instead. Also for libc stuff
registry/src/github.com-1ecc6299db9ec823/ordered-float-0.2.3 # exposes unsafe function that has non-safety-related invariants to hold up. Shouldn't be unsafe.
registry/src/github.com-1ecc6299db9ec823/ws-0.5.3 # needs to transmute to byte arrays
registry/src/github.com-1ecc6299db9ec823/tar-0.4.8 # sloppy API
Specifically deals with unicode, needs unchecked utf8:
registry/src/github.com-1ecc6299db9ec823/encode_unicode-0.1.3
registry/src/github.com-1ecc6299db9ec823/encoding-0.2.33
registry/src/github.com-1ecc6299db9ec823/unicode-normalization-0.1.2
registry/src/github.com-1ecc6299db9ec823/utf8-ranges-0.1.3
FFI/OS/abstractions:
git/checkouts/ipc-channel-8c79851162410a92 # OS primitives
git/checkouts/picorust-49867e6f8efda92b # FFI
registry/src/github.com-1ecc6299db9ec823/backtrace-0.2.2 # OS primitives / FFI
registry/src/github.com-1ecc6299db9ec823/bit-vec-0.4.3 # abstraction
registry/src/github.com-1ecc6299db9ec823/byteorder-0.5.3 # abstraction
registry/src/github.com-1ecc6299db9ec823/bytes-0.3.0 # abstraction
registry/src/github.com-1ecc6299db9ec823/cargo-0.12.0 # FFI with terminal stuff
registry/src/github.com-1ecc6299db9ec823/cexpr-0.2.0 # in tests
registry/src/github.com-1ecc6299db9ec823/chrono-0.2.22 # send impl
registry/src/github.com-1ecc6299db9ec823/clang-sys-0.12.0 # FFI
registry/src/github.com-1ecc6299db9ec823/clap-2.19.2 # terminal handling stuff (FFI)
registry/src/github.com-1ecc6299db9ec823/clippy_lints-0.0.79 # ditto
registry/src/github.com-1ecc6299db9ec823/cmake-0.1.18 # ffi
registry/src/github.com-1ecc6299db9ec823/cocoa-0.4.4 # ffi
registry/src/github.com-1ecc6299db9ec823/compiletest_rs-0.2.0 # in comments
registry/src/github.com-1ecc6299db9ec823/core-foundation-0.2.2 # ffi
registry/src/github.com-1ecc6299db9ec823/core-graphics-0.3.2 # ffi
registry/src/github.com-1ecc6299db9ec823/crossbeam-0.2.10 # abstraction
registry/src/github.com-1ecc6299db9ec823/curl-0.3.11 # ffi
registry/src/github.com-1ecc6299db9ec823/curl-sys-0.2.5 # ditto
registry/src/github.com-1ecc6299db9ec823/debug_unreachable-0.1.1 # tests
registry/src/github.com-1ecc6299db9ec823/deque-0.3.1 # abstraction
registry/src/github.com-1ecc6299db9ec823/docopt-0.6.78 # ctags file, not unsafe code
registry/src/github.com-1ecc6299db9ec823/dtoa-0.2.2
registry/src/github.com-1ecc6299db9ec823/euclid-0.10.1 # simd via asm
registry/src/github.com-1ecc6299db9ec823/filetime-0.1.10 # OS
registry/src/github.com-1ecc6299db9ec823/fixedbitset-0.1.1 # abstraction
registry/src/github.com-1ecc6299db9ec823/flate2-0.2.14 # ffi
registry/src/github.com-1ecc6299db9ec823/fs2-0.2.5 # ffi
registry/src/github.com-1ecc6299db9ec823/fsevent-0.2.15 # ffi
registry/src/github.com-1ecc6299db9ec823/gcc-0.3.21 # ffi
registry/src/github.com-1ecc6299db9ec823/git2-0.4.4 # ffi
registry/src/github.com-1ecc6299db9ec823/git2-curl-0.5.0 # ffi
registry/src/github.com-1ecc6299db9ec823/gl_generator-0.5.1 # ffi
registry/src/github.com-1ecc6299db9ec823/gleam-0.2.20 # ffi
registry/src/github.com-1ecc6299db9ec823/heapsize-0.3.6 # ffi with jemalloc
registry/src/github.com-1ecc6299db9ec823/hyper-0.9.14 # OS stuff (file descriptors etc)
registry/src/github.com-1ecc6299db9ec823/iron-0.4.0 # tests
registry/src/github.com-1ecc6299db9ec823/itertools-0.4.19 # abstractions
registry/src/github.com-1ecc6299db9ec823/lazy_static-0.1.15 # abstractions
registry/src/github.com-1ecc6299db9ec823/libc-0.1.12 # FFI/OS
registry/src/github.com-1ecc6299db9ec823/libgit2-sys-0.4.5 # FFI
registry/src/github.com-1ecc6299db9ec823/libloading-0.3.1 # FFI
registry/src/github.com-1ecc6299db9ec823/libsqlite3-sys-0.5.0 # FFI
registry/src/github.com-1ecc6299db9ec823/libssh2-sys-0.1.39 # FFI
registry/src/github.com-1ecc6299db9ec823/libz-sys-1.0.6 # FFI
registry/src/github.com-1ecc6299db9ec823/linked-hash-map-0.0.9 # abstraction
registry/src/github.com-1ecc6299db9ec823/malloc_buf-0.0.6 # abstraction
registry/src/github.com-1ecc6299db9ec823/memchr-0.1.11 # abstraction over a ibc func
registry/src/github.com-1ecc6299db9ec823/memmap-0.2.3 # abstraction
registry/src/github.com-1ecc6299db9ec823/mio-0.5.1 # abstraction over OS primitives
registry/src/github.com-1ecc6299db9ec823/miow-0.1.2 # OS stuff
registry/src/github.com-1ecc6299db9ec823/net2-0.2.25 # OS
registry/src/github.com-1ecc6299db9ec823/nix-0.5.1 # OS
registry/src/github.com-1ecc6299db9ec823/notify-2.6.3 # OS
registry/src/github.com-1ecc6299db9ec823/num_cpus-0.2.10 # OS
registry/src/github.com-1ecc6299db9ec823/objc-0.2.1 # FFI
registry/src/github.com-1ecc6299db9ec823/openssl-0.7.13 #FFI
registry/src/github.com-1ecc6299db9ec823/openssl-sys-0.7.13 #FFI
registry/src/github.com-1ecc6299db9ec823/openssl-sys-extras-0.7.13 # FFI
registry/src/github.com-1ecc6299db9ec823/ordermap-0.2.7 # abstraction
registry/src/github.com-1ecc6299db9ec823/owning_ref-0.2.2 # abstraction
registry/src/github.com-1ecc6299db9ec823/parking_lot-0.3.5 # abstraction
registry/src/github.com-1ecc6299db9ec823/parking_lot_core-0.2.0 # abstraction
registry/src/github.com-1ecc6299db9ec823/petgraph-0.2.7 # abstraction
registry/src/github.com-1ecc6299db9ec823/rayon-0.5.0 # abstraction
registry/src/github.com-1ecc6299db9ec823/ring-0.4.3 # FFI
registry/src/github.com-1ecc6299db9ec823/ripgrep-0.1.16 # tty/mmap stuff
registry/src/github.com-1ecc6299db9ec823/rusqlite-0.7.3 # ffi
registry/src/github.com-1ecc6299db9ec823/rustc-test-0.1.3 # tty/libc stuff
registry/src/github.com-1ecc6299db9ec823/rustyline-1.0.0 # tty stff
registry/src/github.com-1ecc6299db9ec823/serde-0.6.15 # implementation of serialization for intrinsically unsafe types like NonZero
registry/src/github.com-1ecc6299db9ec823/shared_library-0.1.4 # ffi
registry/src/github.com-1ecc6299db9ec823/simd-0.1.1 # abstraction (intrinsics are unsafe)
registry/src/github.com-1ecc6299db9ec823/slab-0.1.3 # send impl because of phantom types
registry/src/github.com-1ecc6299db9ec823/smallvec-0.1.8 # abstraction
registry/src/github.com-1ecc6299db9ec823/string_cache-0.2.29
registry/src/github.com-1ecc6299db9ec823/strings-0.0.1
registry/src/github.com-1ecc6299db9ec823/term-0.2.14 # FFI
registry/src/github.com-1ecc6299db9ec823/term_size-0.1.0 # FFI
registry/src/github.com-1ecc6299db9ec823/thread-id-2.0.0 # FFI
registry/src/github.com-1ecc6299db9ec823/thread_local-0.2.5 # OS/ffi
registry/src/github.com-1ecc6299db9ec823/time-0.1.34 # OS / ffi
registry/src/github.com-1ecc6299db9ec823/traitobject-0.0.1 # abstraction
registry/src/github.com-1ecc6299db9ec823/typed-arena-1.1.0 # abstraction
registry/src/github.com-1ecc6299db9ec823/typemap-0.3.3 # abstraction
registry/src/github.com-1ecc6299db9ec823/unreachable-0.1.1 # abstraction
registry/src/github.com-1ecc6299db9ec823/unsafe-any-0.4.1 # specifically an unsafe abstraction
registry/src/github.com-1ecc6299db9ec823/void-1.0.2 # abstraction
registry/src/github.com-1ecc6299db9ec823/wait-timeout-0.1.3 # libc stuff
registry/src/github.com-1ecc6299db9ec823/walkdir-0.1.6 # OS stuff
registry/src/github.com-1ecc6299db9ec823/winapi-0.2.5 # OS/FFI
registry/src/github.com-1ecc6299db9ec823/xattr-0.1.10 # FFI
registry/src/github.com-1ecc6299db9ec823/xml-rs-0.3.4 # tests
@dtolnay
Copy link

dtolnay commented Dec 30, 2016

registry/src/github.com-1ecc6299db9ec823/serde-0.6.15 # implementation of serialization for intrinsically unsafe types like NonZero

It isn't "types like NonZero," it is that single one type (one line of unsafe code). In any case I wouldn't say they are intrinsically unsafe, we just need to add a safe (checked) way to construct NonZero<T>. rust-lang/rust#27730 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment