Skip to content
This repository was archived by the owner on Apr 7, 2023. It is now read-only.
This repository was archived by the owner on Apr 7, 2023. It is now read-only.

Compound File limit size to 268434944 bytes? #3

Open
@ras254

Description

@ras254

I can't create a compound file more than 268434944 bytes. I got StackOverflow exception when try to do this.
SectorCollection.cs has a line
private const int MAX_SECTOR_V4_COUNT_LOCK_RANGE = 524287; //0x7FFFFF00 for Version 4
This is limited max file size to 524287*512 = 268434944 bytes.
What is wrong?

Activity

salaros

salaros commented on Feb 26, 2017

@salaros
Collaborator

MAX_SECTOR_V4_COUNT_LOCK_RANGE variable refers to so-called Range Lock Sector, a special area inside files larger than 2 GB (situated just before 2 GB threshold). This area is reserved for concurrent file access management, so it has to be empty or something (so basically you are not supposed to store your data in 0x7FFFFF00 -> 0x7FFFFFFF), I'm not sure.

As you might have noticed I forked OpenMCDF project in Nov 2016 in order to make its NuGet package compatible with .NET Core, but I don't know much about how it works at the low-lever.

However if you provide me with some instructions on how to reproduce the issue you have reported I will try to fix it.

ras254

ras254 commented on Feb 28, 2017

@ras254
Author

This sample reproduces an error (StackOverflowException)

    class Program
    {
        static void Main(string[] args)
        {
            using (var file = new CompoundFile())
            {
                var storage = file.RootStorage.AddStorage("a");
                var stream = storage.AddStream("b");
                stream.Append(new byte[300 * 1024 * 1024]);
                file.Save(@"bigfile.bin");
            }
        }
    }
bormm

bormm commented on Jul 26, 2017

@bormm

@ras254: This project is a old fork of the original OpenMcdf source hosted on sourceforge. I would recommend using and improving the original now, after it also moved to github a while ago: (https://github.com/ironfede/openmcdf).

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @salaros@ras254@bormm

        Issue actions

          Compound File limit size to 268434944 bytes? · Issue #3 · CodeCavePro/OpenMCDF