Dark Messiah of Might and Magic GCF extraction fails due to the next index being one past the final entry index #16

Open
opened 2026-01-29 21:16:35 +00:00 by claunia · 0 comments
Owner

Originally created by @HeroponRikiBestest on GitHub (Nov 30, 2025).

Seems to impact most if not all of the GCF files, in all releases of Dark Messiah of Might and Magic on redump. For this output, I'm using mm_engine_pub.gcf since it's one of the smallest ones and should be present on every release.

When running get_files for the GCFs, the wrapper enters this loop

4b39ee8d00/SabreTools.Serialization/Wrappers/GCF.cs (L95)

with a valid starting index. However, after it's been added to the block entries, it tries to get the index of the next block. The index it gets is 22781. The size of Model.BlockEntries for this GCF is 22781, so this will fail with an out of bounds exception. I assume it's not coincidence that it just happens to be the exact size of the array, but I don't know enough about GCFs to say why.

Console output:

Checking possible path: /home/bestest/testBosIssue/mm_engine_pub.gcf
Attempting to extract all files from /home/bestest/testBosIssue/mm_engine_pub.gcf
Attempting to extract from 'Half-Life Game Cache File (GCF)'

Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at SabreTools.Serialization.Wrappers.GCF.get_Files() in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/SabreTools.Serialization/Wrappers/GCF.cs:line 97
   at SabreTools.Serialization.Wrappers.GCF.Extract(String outputDirectory, Boolean includeDebug) in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/SabreTools.Serialization/Wrappers/GCF.Extraction.cs:line 13
   at ExtractionTool.Features.MainFeature.ExtractFile(String file) in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/ExtractionTool/Features/MainFeature.cs:line 180
   at ExtractionTool.Features.MainFeature.ExtractPath(String path) in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/ExtractionTool/Features/MainFeature.cs:line 95
   at ExtractionTool.Features.MainFeature.Execute() in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/ExtractionTool/Features/MainFeature.cs:line 73
Originally created by @HeroponRikiBestest on GitHub (Nov 30, 2025). Seems to impact most if not all of the GCF files, in all releases of Dark Messiah of Might and Magic on redump. For this output, I'm using `mm_engine_pub.gcf` since it's one of the smallest ones and should be present on every release. When running get_files for the GCFs, the wrapper enters this loop https://github.com/SabreTools/SabreTools.Serialization/blob/4b39ee8d0058ce20101c0ae41ef755e6fe6e3f50/SabreTools.Serialization/Wrappers/GCF.cs#L95 with a valid starting index. However, after it's been added to the block entries, it tries to get the index of the next block. The index it gets is 22781. The size of Model.BlockEntries for this GCF is 22781, so this will fail with an out of bounds exception. I assume it's not coincidence that it just happens to be the exact size of the array, but I don't know enough about GCFs to say why. Console output: ``` Checking possible path: /home/bestest/testBosIssue/mm_engine_pub.gcf Attempting to extract all files from /home/bestest/testBosIssue/mm_engine_pub.gcf Attempting to extract from 'Half-Life Game Cache File (GCF)' Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array. at SabreTools.Serialization.Wrappers.GCF.get_Files() in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/SabreTools.Serialization/Wrappers/GCF.cs:line 97 at SabreTools.Serialization.Wrappers.GCF.Extract(String outputDirectory, Boolean includeDebug) in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/SabreTools.Serialization/Wrappers/GCF.Extraction.cs:line 13 at ExtractionTool.Features.MainFeature.ExtractFile(String file) in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/ExtractionTool/Features/MainFeature.cs:line 180 at ExtractionTool.Features.MainFeature.ExtractPath(String path) in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/ExtractionTool/Features/MainFeature.cs:line 95 at ExtractionTool.Features.MainFeature.Execute() in /home/runner/work/SabreTools.Serialization/SabreTools.Serialization/ExtractionTool/Features/MainFeature.cs:line 73 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SabreTools/SabreTools.Serialization#16