Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/helpers/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public: \
ref.instantiate(); \
ref->_wrapped = wrapped; \
char path[MAX_PATH_SIZE]; \
ERROR_CHECK(wrapped->getPath(path, MAX_PATH_SIZE, nullptr)); \
ERROR_CHECK_WITH_REASON(wrapped->getPath(path, MAX_PATH_SIZE, nullptr), "Could not find path. It is likely that .strings.bank has not been loaded."); \
ERROR_CHECK(wrapped->getID(&ref->_guid)); \
ref->_path = String(path); \
Comment on lines 69 to 72

Copilot AI Mar 28, 2026

Copy link

Choose a reason for hiding this comment

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

wrapped->getPath(...) can fail (e.g., when the strings bank isn’t loaded), but the return value from ERROR_CHECK_WITH_REASON(...) is currently ignored. If it fails, path remains uninitialized and ref->_path = String(path) can read garbage / run past the buffer (undefined behavior) while also continuing to populate _guid. Handle the failure explicitly (e.g., initialize path to an empty string and/or early-return an empty Ref or set _path to "" when getPath fails).

Copilot uses AI. Check for mistakes.
} \
Expand Down
Loading