Skip to content

Commit

Permalink
Fix crash in vapoursynth decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
shssoichiro committed Dec 2, 2022
1 parent 22bc881 commit 2205b29
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion av_metrics_decoders/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "av-metrics-decoders"
version = "0.2.0"
version = "0.2.1"
authors = ["Josh Holmer <[email protected]>"]
edition = "2021"
description = "Decoders for use with av-metrics"
Expand Down
8 changes: 7 additions & 1 deletion av_metrics_decoders/src/vapoursynth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ impl Decoder for VapoursynthDecoder {
&mut self,
) -> Option<av_metrics::video::Frame<T>> {
let details = self.get_video_details();
assert!(details.bit_depth == size_of::<T>());
if details.bit_depth <= 8 {
assert!(size_of::<T>() == 1);
} else if details.bit_depth <= 16 {
assert!(size_of::<T>() == 2);
} else {
panic!("Unsupported bit depth");
}

let mut f: av_metrics::video::Frame<T> = av_metrics::video::Frame::new_with_padding(
details.width,
Expand Down

0 comments on commit 2205b29

Please sign in to comment.