Skip to content

Commit

Permalink
Merge pull request #427 from KirkLandTrip/main
Browse files Browse the repository at this point in the history
SequentialStreamReader.cs: Cast numbers to ulong before bound check
  • Loading branch information
drewnoakes authored Oct 9, 2024
2 parents ed79cc0 + 69f9d11 commit 4151d4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MetadataExtractor/IO/SequentialStreamReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public override void Skip(long n)
if (n < 0)
throw new ArgumentException("n must be zero or greater.");

if (_stream.Position + n > _stream.Length)
if ((ulong)(_stream.Position + n) > (ulong)(_stream.Length))
throw new IOException($"Unable to skip. Requested {n} bytes but only {_stream.Length - _stream.Position} remained.");

_stream.Seek(n, SeekOrigin.Current);
Expand Down

0 comments on commit 4151d4f

Please sign in to comment.