Fix the `len > isize::max_value()` condition
Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
parent
cdbbd62de8
commit
0b954f3082
|
@ -27,7 +27,7 @@ impl Mmap {
|
||||||
/// - `len` should be greater than 0.
|
/// - `len` should be greater than 0.
|
||||||
/// - `mmap` returns an error (almost certainly means out of memory).
|
/// - `mmap` returns an error (almost certainly means out of memory).
|
||||||
fn new(len: usize) -> Result<Self, &'static str> {
|
fn new(len: usize) -> Result<Self, &'static str> {
|
||||||
if len >= isize::max_value() as usize {
|
if len > isize::max_value() as usize {
|
||||||
return Err("`len` should not exceed `isize::max_value()`");
|
return Err("`len` should not exceed `isize::max_value()`");
|
||||||
}
|
}
|
||||||
if len == 0 {
|
if len == 0 {
|
||||||
|
|
Loading…
Reference in New Issue