Skip to content

Upgrade OpenMcdf to v3.1.4#1013

Open
Copilot wants to merge 2 commits into
developfrom
copilot/upgrade-openmcdf-to-314
Open

Upgrade OpenMcdf to v3.1.4#1013
Copilot wants to merge 2 commits into
developfrom
copilot/upgrade-openmcdf-to-314

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 15, 2026

OpenMcdf 2.4.1 carries a known moderate-severity vulnerability (NU1902). Upgrading to 3.1.4, which also ships an idiomatic rewritten API.

Package version

  • Directory.Packages.props: OpenMcdf 2.4.13.1.4

API migration (SavedGame.cs)

v3 replaces CompoundFile/CFStream.GetData() with RootStorage and standard Stream semantics:

// Before (v2)
var cf = new CompoundFile(file);
GUIName = Encoding.Unicode.GetString(cf.RootStorage.GetStream("Scenario Description").GetData()).TrimEnd(['\0']);
try { CustomMissionID = BinaryPrimitives.ReadInt32LittleEndian(cf.RootStorage.GetStream("CustomMissionID").GetData()); }
catch (CFItemNotFound) { CustomMissionID = 0; }

// After (v3)
using RootStorage root = RootStorage.Open(file);
using (CfbStream s = root.OpenStream("Scenario Description"))
{
    byte[] data = new byte[s.Length];
    s.ReadExactly(data);
    GUIName = Encoding.Unicode.GetString(data).TrimEnd(['\0']);
}
if (root.TryOpenStream("CustomMissionID", out CfbStream? ms))
{
    using (ms) { byte[] d = new byte[ms.Length]; ms.ReadExactly(d); CustomMissionID = BinaryPrimitives.ReadInt32LittleEndian(d); }
}
else { CustomMissionID = 0; }

Key changes:

  • new CompoundFile(stream)RootStorage.Open(stream)
  • CFStream.GetData() → allocate buffer, CfbStream.ReadExactly()
  • catch (CFItemNotFound) control-flow → TryOpenStream (no exception for the optional CustomMissionID stream)

Copilot AI and others added 2 commits May 15, 2026 19:46
@SadPencil SadPencil changed the title Upgrade OpenMcdf 2.4.1 → 3.1.4 (moderate vulnerability fix) Upgrade OpenMcdf to 3.1.4 May 15, 2026
@SadPencil SadPencil changed the title Upgrade OpenMcdf to 3.1.4 Upgrade OpenMcdf to v3.1.4 May 15, 2026
@SadPencil SadPencil marked this pull request as ready for review May 15, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants