From ae042102abd7a17d1552f72075e5b9ecb1163315 Mon Sep 17 00:00:00 2001 From: morkt Date: Fri, 9 Feb 2018 17:32:43 +0400 Subject: [PATCH] (ArcView): check for disposed object access. --- GameRes/ArcView.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GameRes/ArcView.cs b/GameRes/ArcView.cs index 7bdbec05..66747307 100644 --- a/GameRes/ArcView.cs +++ b/GameRes/ArcView.cs @@ -290,6 +290,8 @@ namespace GameRes { if (offset > m_arc.MaxOffset) throw new ArgumentOutOfRangeException ("offset", "Too large offset specified for memory mapped file view."); + if (disposed) + throw new ObjectDisposedException (null); if (size < ArcView.PageSize) size = (uint)ArcView.PageSize; if (size > m_arc.MaxOffset-offset) @@ -353,6 +355,8 @@ namespace GameRes throw new ArgumentNullException ("buf", "Buffer cannot be null."); if (buf_offset < 0) throw new ArgumentOutOfRangeException ("buf_offset", "Buffer offset should be non-negative."); + if (disposed) + throw new ObjectDisposedException (null); int total = (int)Math.Min (Reserve (offset, count), count); if (buf.Length - buf_offset < total) @@ -481,6 +485,7 @@ namespace GameRes } m_arc = null; m_view = null; + m_size = 0; disposed = true; } } @@ -516,7 +521,7 @@ namespace GameRes if (!_disposed) return m_ptr; else - throw new ObjectDisposedException ("Access to disposed ViewPointer object failed."); + throw new ObjectDisposedException (null, "Access to disposed ViewPointer object failed."); } }