Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

Commit

Permalink
Validate blockAlign can be cast to short
Browse files Browse the repository at this point in the history
  • Loading branch information
nkast committed Sep 5, 2016
1 parent bc90539 commit 1e41b3f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/SharpDX/Multimedia/WaveFormatAdpcm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public WaveFormatAdpcm(int rate, int channels, int blockAlign = 0) : base(rate,
blockAlign = 1024;
}

if (rate <= 0) throw new ArgumentOutOfRangeException("rate", "Must be > 0");
if (channels <= 0) throw new ArgumentOutOfRangeException("channels", "Must be > 0");
if (blockAlign <= 0) throw new ArgumentOutOfRangeException("blockAlign", "Must be > 0");
if (blockAlign > Int16.MaxValue) throw new ArgumentOutOfRangeException("blockAlign", "Must be < 32767");

waveFormatTag = WaveFormatEncoding.Adpcm;
this.blockAlign = (short)blockAlign;

Expand Down

0 comments on commit 1e41b3f

Please sign in to comment.