Skip to content

fix(archive): Delay StdBIGFile allocation until after archive validation - #3196

Open
CryoTheRenegade wants to merge 2 commits into
TheSuperHackers:mainfrom
CryoTheRenegade:fix/std-big-archive-leak
Open

fix(archive): Delay StdBIGFile allocation until after archive validation#3196
CryoTheRenegade wants to merge 2 commits into
TheSuperHackers:mainfrom
CryoTheRenegade:fix/std-big-archive-leak

Conversation

@CryoTheRenegade

@CryoTheRenegade CryoTheRenegade commented Aug 24, 2026

Copy link
Copy Markdown

Clang-tidy found that StdBIGFileSystem::openArchiveFile allocated the archive object before checking whether the file opened or whether the BIG identifier was valid. Those two early-return paths leaked the object.

This matches the existing Win32BIGFileSystem allocation order.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Prevent Std BIG archive leaks on validation failures

🐞 Bug fix 🕐 Less than 5 minutes

Grey Divider

AI Description

• Defers StdBIGFile creation until the archive file and identifier are validated.
• Prevents leaked archive objects on failed opens and malformed BIG files.
• Aligns standard-device archive handling with the Win32 implementation.
Diagram

graph TD
  A["Open request"] --> B["Open file"] --> C{"File opened?"}
  C -- No --> F["Return null"]
  C -- Yes --> D{"Valid BIG ID?"}
  D -- No --> F
  D -- Yes --> E["Allocate archive"] --> G["Parse entries"] --> H["Return archive"]
Loading
High-Level Assessment

The allocation delay is the best targeted fix: it removes ownership obligations from both early-return paths and matches the established Win32 implementation. Broader RAII conversion was considered but would increase scope without improving these pre-allocation failure paths.

Files changed (1) +2 / -2

Bug fix (1) +2 / -2
StdBIGFileSystem.cppDefer StdBIGFile allocation until archive validation succeeds +2/-2

Defer StdBIGFile allocation until archive validation succeeds

• Moves 'StdBIGFile' construction below file-open and BIG-identifier validation. Failed opens and invalid archive headers therefore return without leaking an allocated archive object, matching Win32 allocation ordering.

Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp

Comment thread Core/GameEngineDevice/Source/StdDevice/Common/StdBIGFileSystem.cpp Outdated
@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project System Is Systems related Fix Is fixing something, but is not user facing labels Aug 25, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix Is fixing something, but is not user facing Minor Severity: Minor < Major < Critical < Blocker System Is Systems related ThisProject The issue was introduced by this project, or this task is specific to this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants