Skip to content

fix: resolve reported PBP, MDS and CHD failures - #22

Merged
drpetersonfernandes merged 1 commit into
masterfrom
fix/reported-bugs-and-code-scanning
Nov 24, 2026
Merged

drpetersonfernandes merged 1 commit into
masterfrom
fix/reported-bugs-and-code-scanning

Conversation

@drpetersonfernandes

Copy link
Copy Markdown
Collaborator

Summary

  • PBP short final blocks: PBPSharp now derives the expected size of the last ISO block from the declared ISO9660 sector count. A final block with fewer than 16 sectors extracts successfully; a short middle block is still rejected.
  • Mislabelled PBPs: content inspection now recognizes cooked ISO9660 images from the volume descriptor and routes them to conversion instead of surfacing InvalidHeader.
  • Missing MDSSharp: split-image inspection is isolated in a non-inlined helper so a missing optional assembly cannot abort the size pre-flight.
  • False bug reports: damaged PBP data, unknown .pbp content, permission/privilege failures, browser-launch failures and CHDSharp hunk diagnostics are classified as user-data/environment conditions instead of new bug reports.
  • Code scanning: the two remaining cs/path-combine notes in MdsTests.cs now use Path.Join.
  • PBPSharp version bumped to 1.1.9 and its README/version history updated.

Verification

  • dotnet build CSharp_CHDStudio.sln -c Release - 0 warnings, 0 errors
  • dotnet test CHDStudio.Tests/CHDStudio.Tests.csproj -c Release - 1331 passed, 0 failed
  • jb inspectcode - 0 warnings, 0 errors

Accept short final PBP blocks from the declared ISO size, route mislabelled ISOs by their volume descriptor, degrade gracefully when MDSSharp is unavailable, and stop forwarding CHDSharp hunk diagnostics as separate bug reports. Also resolve the two remaining Path.Combine code-scanning notes in the MDS tests.
Comment on lines +10077 to +10080
catch (Exception clipboardEx)
{
LogMessage($"Failed to copy URL to clipboard: {clipboardEx.Message}");
}
// A plain 2048-byte-sector ISO has no signature in its first sector; the ISO9660 primary
// volume descriptor at sector 16 is what identifies it. This is the shape of the .pbp
// files that were really renamed ISOs and failed with InvalidHeader.
var path = Path.Combine(_tempDir, "game.pbp");
// A disc whose sector count is not a multiple of 16 can store its last index block with
// only the sectors the image actually contains. The block is complete at its own declared
// size, not at the padded 16-sector size, and must extract successfully.
var path = Path.Combine(_tempDir, $"shortfinal_{Guid.NewGuid():N}.pbp");
pbp.Discs[0].ExtractTo(outputStream);
Assert.Equal(expectedIsoSize, (uint)outputStream.Length);

var binPath = Path.Combine(_tempDir, $"{Guid.NewGuid():N}.bin");
// A plain 2048-byte-sector ISO has no signature in its first sector; the ISO9660 primary
// volume descriptor at sector 16 is what identifies it. This is the shape of the .pbp
// files that were really renamed ISOs and failed with InvalidHeader.
var path = Path.Combine(_tempDir, "game.pbp");
// A disc whose sector count is not a multiple of 16 can store its last index block with
// only the sectors the image actually contains. The block is complete at its own declared
// size, not at the padded 16-sector size, and must extract successfully.
var path = Path.Combine(_tempDir, $"shortfinal_{Guid.NewGuid():N}.pbp");
pbp.Discs[0].ExtractTo(outputStream);
Assert.Equal(expectedIsoSize, (uint)outputStream.Length);

var binPath = Path.Combine(_tempDir, $"{Guid.NewGuid():N}.bin");
Comment on lines +10077 to +10080
catch (Exception clipboardEx)
{
LogMessage($"Failed to copy URL to clipboard: {clipboardEx.Message}");
}
@drpetersonfernandes
drpetersonfernandes merged commit 9a92d34 into master Nov 24, 2026
12 checks passed
@drpetersonfernandes
drpetersonfernandes deleted the fix/reported-bugs-and-code-scanning branch November 24, 2026 02:28
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