Skip to content

Commit

Permalink
Defense against timebase with denominator 0
Browse files Browse the repository at this point in the history
  • Loading branch information
xdrudis authored and edaniels committed Jan 2, 2025
1 parent 40358b3 commit 1ee0299
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/media/ivfreader/ivfreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var (
errIncompleteFileHeader = errors.New("incomplete file header")
errSignatureMismatch = errors.New("IVF signature mismatch")
errUnknownIVFVersion = errors.New("IVF version unknown, parser may not parse correctly")
errInvalidMediaTimebase = errors.New("invalid media timebase")
)

// IVFFileHeader 32-byte header for IVF files
Expand Down Expand Up @@ -71,6 +72,9 @@ func NewWith(in io.Reader) (*IVFReader, *IVFFileHeader, error) {
if err != nil {
return nil, nil, err
}
if header.TimebaseDenominator == 0 {
return nil, nil, errInvalidMediaTimebase
}
reader.timebaseDenominator = header.TimebaseDenominator
reader.timebaseNumerator = header.TimebaseNumerator

Expand Down

0 comments on commit 1ee0299

Please sign in to comment.