fn read_uleb_internal<T>(cursor: &mut VersionedCursor, max: u64) -> BinaryLoaderResult<T>
where
    u64: TryInto<T>,
{
    let x = cursor.read_uleb128_as_u64().map_err(|_| {
        PartialVMError::new(StatusCode::MALFORMED).with_message("Bad Uleb".to_string())
    })?;
    if x > max {
        return Err(PartialVMError::new(StatusCode::MALFORMED)
            .with_message("Uleb greater than max requested".to_string()));
    }

    x.try_into().map_err(|_| {
        // TODO: review this status code.
        let msg = "Failed to convert u64 to target integer type. This should not happen. Is the maximum value correct?".to_string();
        PartialVMError::new(StatusCode::UNKNOWN_INVARIANT_VIOLATION_ERROR).with_message(msg)
    })
}
//
// Helpers to read all uleb128 encoded integers.
//
Helpers to read all uleb128 encoded integers.
Helpers to read all uleb128 encoded integers .
fn read_uleb_internal<T>(cursor: &mut VersionedCursor, max: u64) -> BinaryLoaderResult<T>
where
    u64: TryInto<T>,
{
    let x = cursor.read_uleb128_as_u64().map_err(|_| {
        PartialVMError::new(StatusCode::MALFORMED).with_message("Bad Uleb".to_string())
    })?;
    if x > max {
        return Err(PartialVMError::new(StatusCode::MALFORMED)
            .with_message("Uleb greater than max requested".to_string()));
    }
    x.try_into().map_err(|_| {
        // TODO: review this status code.
        let msg = "Failed to convert u64 to target integer type. This should not happen. Is the maximum value correct?".to_string();
        PartialVMError::new(StatusCode::UNKNOWN_INVARIANT_VIOLATION_ERROR).with_message(msg)
    })
}
fn read_uleb_internal < T > ( cursor : & mut VersionedCursor , max : u64 ) -> BinaryLoaderResult < T > where u64 : TryInto < T > , { let x = cursor . read_uleb128_as_u64 ( ) . map_err ( | _ | { PartialVMError :: new ( StatusCode :: MALFORMED ) . with_message ( " " . to_string ( ) ) } ) ? ; if x > max { return Err ( PartialVMError :: new ( StatusCode :: MALFORMED ) . with_message ( " " . to_string ( ) ) ) ; } x . try_into ( ) . map_err ( | _ | { // TODO: review this status code. let msg = " " . to_string ( ) ; PartialVMError :: new ( StatusCode :: UNKNOWN_INVARIANT_VIOLATION_ERROR ) . with_message ( msg ) } ) }
Helpers to read all uleb128 encoded integers.
Helpers to read all uleb128 encoded integers .
cursor
&mut VersionedCursor
max
u64