From 69f9d11f140591a6013edd9d4c6568cae0603680 Mon Sep 17 00:00:00 2001 From: KirkLandTrip <112394801+KirkLandTrip@users.noreply.github.com> Date: Mon, 7 Oct 2024 13:46:09 +0300 Subject: [PATCH] SequentialStreamReader.cs: Cast numbers to ulong before bound check --- MetadataExtractor/IO/SequentialStreamReader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MetadataExtractor/IO/SequentialStreamReader.cs b/MetadataExtractor/IO/SequentialStreamReader.cs index 4fdd1af8..fee9bb48 100644 --- a/MetadataExtractor/IO/SequentialStreamReader.cs +++ b/MetadataExtractor/IO/SequentialStreamReader.cs @@ -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);