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

Improve safety & usability of |size_t| and |ssize_t|. #29222

Closed
wants to merge 4 commits into from

Commits on Oct 22, 2015

  1. Add additional automatic conversions to usize/isize.

    Also, improve the documentation related to the range of usize and
    isize.
    briansmith committed Oct 22, 2015
    Configuration menu
    Copy the full SHA
    0f2eaa2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    efdc16b View commit details
    Browse the repository at this point in the history
  3. Remove dangerous and unnecessary casts of |usize| to |libc::size_t|.

    Since |usize| may be larger than |libc::size_t|, it is generally not safe to
    cast from |usize| to |libc::size_t|.
    
    The effect of this commit is to cause the build to fail on a platform where
    `libc::size_t` isn't the same as `usize`. But, that is better than the current
    state of affairs, where unsafe truncations can occur on such platforms,
    potentially leading to buffer overflows and other unsafety.
    briansmith committed Oct 22, 2015
    Configuration menu
    Copy the full SHA
    e2311fc View commit details
    Browse the repository at this point in the history
  4. Remove some now-unnecessary casts of |size_t| to |usize|.

    I didn't try to find every such cast. I concentrated on the files that
    had now-unnecessary casts from |usize| to |size_t|.
    briansmith committed Oct 22, 2015
    Configuration menu
    Copy the full SHA
    5864ba9 View commit details
    Browse the repository at this point in the history