ironfede / openmcdf

Microsoft Compound File .net component - pure C# - netstandard 2.0
Mozilla Public License 2.0
297 stars 73 forks source link

ArgumentOutOfRangeException in GetDifatSectorChain #42

Closed christianscheuer closed 4 years ago

christianscheuer commented 5 years ago

Hi, Really loving this project!

On certain AAF files from Premiere I'm getting an ArgumentOutOfRangeException. Notably, Argument Out of Range, possibly corrupted file

Stack trace:

Unhandled Exception: OpenMcdf.CFException: Argument Out of Range, possibly corrupted file ---> System.ArgumentOutOfRangeException: Argument out of range
Parameter name: index
Actual value was 100125.
   --- End of inner exception stack trace ---
   at OpenMcdf.SectorCollection.get_Item(Int32 index) in /src/OpenMcdf/SectorCollection.cs:line 86
   at OpenMcdf.CompoundFile.GetDifatSectorChain() in /src/OpenMcdf/CompoundFile.cs:line 1311
   at OpenMcdf.CompoundFile.GetFatSectorChain() in /src/OpenMcdf/CompoundFile.cs:line 1351
   at OpenMcdf.CompoundFile.GetNormalSectorChain(Int32 secID) in /src/OpenMcdf/CompoundFile.cs:line 1442
   at OpenMcdf.CompoundFile.GetSectorChain(Int32 secID, SectorType chainType) in /src/OpenMcdf/CompoundFile.cs:line 1556
   at OpenMcdf.CompoundFile.LoadDirectories() in /src/OpenMcdf/CompoundFile.cs:line 1810
   at OpenMcdf.CompoundFile.Load(Stream stream) in /src/OpenMcdf/CompoundFile.cs:line 693
   at OpenMcdf.CompoundFile.LoadFile(String fileName) in /src/OpenMcdf/CompoundFile.cs:line 726
   at OpenMcdf.CompoundFile..ctor(String fileName, CFSUpdateMode updateMode, CFSConfiguration configParameters) in /src/OpenMcdf/CompoundFile.cs:line 378

I'm trying to find a smaller repro sample file that I can send, but currently the files I have cannot be shared publicly. @ironfede if you want I can send you something in a PM.

These files open up well in other applications so even if they might be somewhat broken, they're not completely broken - so finding out how to make them load in OpenMcdf would be great.

Hope you can help me out, Thanks in advance

ironfede commented 4 years ago

@christianscheuer Sorry for super-delayed response... really a busy time. If you're still following this project, could you please try to find a publicly shareable file to add as unit test/debug item to project in order to check for this issue? I've seen your solution and I think it's ok for your specific case but I've still some doubts in its generalization. Thank you very much, Federico

christianscheuer commented 4 years ago

Hi @ironfede, thanks for following up. We had to switch to a native implementation - we're now using the native c++ AAF SDK which is a more complete solution to reading AAFs anway. So I haven't tested this much further unfortunately. I really do like the approach of having it run as managed code though, it just ended up being cheaper for us to go native.

ironfede commented 4 years ago

Thank you anyway @christianscheuer. I'm going to close this issue because it's difficult to me generalize solution without a full test case but if you find out something new about aaf peculiarities please open a new track item in order to investigate. Many thanks!

christianscheuer commented 4 years ago

Makes sense - thank you again Federico :)