Skip to content

Trap more bad_alloc for input images#633

Merged
solidpixel merged 3 commits into
mainfrom
issue_630
Jun 2, 2026
Merged

Trap more bad_alloc for input images#633
solidpixel merged 3 commits into
mainfrom
issue_630

Conversation

@solidpixel
Copy link
Copy Markdown
Contributor

@solidpixel solidpixel commented Jun 2, 2026

Captures bad_alloc for cases where new[] is driven by allocations trigged by user-defined images, which could be malicious.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves robustness of the CLI image loading path by catching allocation-related failures (notably new[]/image allocation paths) when image dimensions come from user-controlled input, preventing abrupt termination on out-of-memory scenarios.

Changes:

  • Wrap KTX/DDS surface buffer allocations and alloc_image() calls in exception handling to trap allocation failures.
  • Add a top-level exception trap around the selected loader call in load_ncimage().
  • Refactor loader/storer descriptor tables to use named function-pointer typedefs and spec structs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Source/astcenccli_image_load_store.cpp Outdated
Comment thread Source/astcenccli_image_load_store.cpp Outdated
Comment thread Source/astcenccli_image_load_store.cpp Outdated
Comment thread Source/astcenccli_image_load_store.cpp Outdated
Comment thread Source/astcenccli_image_load_store.cpp Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment thread Source/astcenccli_image_load_store.cpp
Comment thread Source/astcenccli_image_load_store.cpp
Comment thread Source/astcenccli_image_load_store.cpp
@solidpixel solidpixel merged commit f246913 into main Jun 2, 2026
10 checks passed
@solidpixel solidpixel deleted the issue_630 branch June 2, 2026 22:06
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