Skip to content

Commit

Permalink
Check for maximum versions as well
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkleeman committed Dec 13, 2024
1 parent 9fbcb21 commit d30a61a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,17 @@ impl super::VM for CoreVM {
.ok_or(errors::MISSING_CONTENT_TYPE)?
.parse::<Version>()?;

if version < Version::minimum_supported_version() {
if version < Version::minimum_supported_version()
|| version > Version::maximum_supported_version()
{
return Err(Error::new(
errors::codes::UNSUPPORTED_MEDIA_TYPE,
format!("Unsupported protocol version {:?}", version),
format!(
"Unsupported protocol version {:?}. Supported versions: {:?} to {:?}",
version,
Version::minimum_supported_version(),
Version::maximum_supported_version()
),
));
}

Expand Down

0 comments on commit d30a61a

Please sign in to comment.