Skip to content

Upgrade Core to 5d5098cc7c7537f4ff3da9848233ea314faffb2f#667

Merged
jviotti merged 1 commit intomainfrom
core-upgrade
Feb 24, 2026
Merged

Upgrade Core to 5d5098cc7c7537f4ff3da9848233ea314faffb2f#667
jviotti merged 1 commit intomainfrom
core-upgrade

Conversation

@jviotti
Copy link
Member

@jviotti jviotti commented Feb 24, 2026

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

@augmentcode
Copy link

augmentcode bot commented Feb 24, 2026

🤖 Augment PR Summary

Summary: Updates the vendored sourcemeta/core dependency to commit 5d5098c….

Changes:

  • Removes the core::io dependency from the URI template router view build target
  • Switches URITemplateRouterView from a memory-mapped FileView to an in-memory buffer loaded via std::ifstream
  • Adds URITemplateRouterReadError for router load/validation failures
  • Adds extra bounds checks during matching to better handle malformed router data

Technical Notes: Router files are now validated on load (magic/version/minimum size) and matched using the loaded byte buffer.

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

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

Review completed. 5 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

const char *segment, const std::uint32_t segment_length,
const std::uint32_t node_count, const std::size_t string_table_size)
noexcept -> std::uint32_t {
if (first_child >= node_count ||
Copy link

Choose a reason for hiding this comment

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

Because first_child/child_count are std::uint32_t values coming from disk, first_child + child_count can overflow and bypass this guard. That could lead to out-of-bounds reads when indexing nodes.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

const auto middle = low + (high - low) / 2;
const auto child_index = first_child + middle;
const auto &child = nodes[child_index];
if (child.string_offset + child.string_length > string_table_size) {
Copy link

Choose a reason for hiding this comment

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

The expression child.string_offset + child.string_length is evaluated in std::uint32_t and can wrap before being compared to string_table_size, potentially letting invalid offsets through. The same overflow pattern exists for variable_node.string_offset + variable_node.string_length.

Severity: medium

Other Locations
  • vendor/core/src/core/uritemplate/uritemplate_router_view.cc:317

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

throw URITemplateRouterReadError{path};
}

const auto minimum_size =
Copy link

Choose a reason for hiding this comment

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

header->node_count * sizeof(Node) can overflow size_t, making minimum_size smaller than the real required size and allowing later pointer arithmetic to walk past data_. Since this parses on-disk data, it’s worth guarding the size computations against overflow.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

const auto *string_table =
header->string_table_offset < this->file_view_.size()
? this->file_view_.as<char>(header->string_table_offset)
header->string_table_offset <= this->data_.size()
Copy link

Choose a reason for hiding this comment

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

string_table_offset is only checked against data_.size(); if it points into the node array, matching may interpret node bytes as strings and produce incorrect routing results without failing. Consider validating the string table starts after the node array when constructing the view.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

URITemplateRouterReadError(std::filesystem::path path)
: path_{std::move(path)} {}

[[nodiscard]] auto what() const noexcept -> const char * override {
Copy link

Choose a reason for hiding this comment

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

URITemplateRouterReadError::what() says "Failed to open router file for reading", but this exception is also thrown for short reads / size checks / magic+version validation failures. A more general message (or capturing the reason) would make failures much easier to diagnose.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@jviotti jviotti merged commit dd00098 into main Feb 24, 2026
6 checks passed
@jviotti jviotti deleted the core-upgrade branch February 24, 2026 19:57
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.

1 participant