FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Crash with buffered stream reads · Issue #184 · openmcdf/openmcdf · GitHub

Crash with buffered stream reads #184

Description

Reading from a StreamDecorator using a BufferedStream may throw an ArgumentOutOfRangeException:

            using CompoundFile cf = new(CFSVersion.Ver_4, CFSConfiguration.Default);

            CFStream cfStream = cf.RootStorage.AddStream("MyStream");
            using Stream stream = cfStream.AsIOStream();
            const int BufferLength = 4096 * 21;
            var buffer = Helpers.GetBuffer(BufferLength);
            stream.Write(buffer, 0, buffer.Length);
            stream.Position = 0;

            Assert.AreEqual(BufferLength, cfStream.Size);

            using MemoryStream memoryStream = new();
            using BufferedStream bufferedStream = new(stream);
            bufferedStream.CopyTo(memoryStream);
    ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
    List`1.get_Item(Int32 index)
    StreamView.Read(Byte[] buffer, Int32 offset, Int32 count) line 119
    CompoundFile.ReadData(IDirectoryEntry de, Int64 position, Byte[] buffer, Int32 offset, Int32 count) line 2239
    CFStream.Read(Byte[] buffer, Int64 position, Int32 offset, Int32 count) line 201
    StreamDecorator.Read(Byte[] buffer, Int32 offset, Int32 count) line 69
    BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL