Skip to content

Boundary error when returning a list #18

Description

@BlackEdder

I have some code that returns a vector of ResourcePtrs, but when I try to use these, it results in a segsev boundary error. Before I had the code in the C nif and it worked fine. Snippet of code:

  std::vector<fine::ResourcePtr<TSNode>> lst(match.capture_count);
  for (int i = 0; i < match.capture_count; ++i) {
    lst[i] = fine::make_resource<TSNode>(match.captures[i].node);
  }
  // TODO: Do we ever need the match id and pattern_index?
  return fine::Ok(
      std::tuple<uint64_t, uint64_t, std::vector<fine::ResourcePtr<TSNode>>>(
          match.id, match.pattern_index, lst));

The error fish: Job 1, 'mix test' terminated by signal SIGSEGV (Address boundary error)

The full code is available here: https://codeberg.org/edwinvanl/treesitter_elixir/src/commit/cc104432af4b3765d2e4b557bf6105327bb324c4/src/treesitter_nif.cpp#L234
and the original C nif code: https://codeberg.org/edwinvanl/treesitter_elixir/src/commit/30d57f683876a12de303679636c872b19ec6f0a6/src/treesitter_nif.c#L444

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions