Skip to content

Conversation

@chocolatebakery
Copy link

C Binding similar to ffish.js, no credits to me.
Used GPT-CODEX5.1-max to create it, for self use (basically a copy-paste of ffish.js to a C binding DLL)

Cheers 🥰

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +505 to +509
FSF_API int fsf_validate_fen(const char* fen, const char* variant, bool is960) {
return ffish::validate_fen(fen ? fen : "", variant ? variant : "chess", is960);
}
FSF_API const char* fsf_starting_fen(const char* variant) {
return to_cstr(ffish::starting_fen(variant ? variant : "chess"));

Choose a reason for hiding this comment

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

P1 Badge Initialize metadata calls before accessing variants

The C entry points that only query metadata (fsf_validate_fen, fsf_starting_fen, fsf_captures_to_hand) call ffish::starting_fen/validate_fen, which in turn dereference variants.find("chess")->second in get_variant without first ensuring variants.init() has run. If a client queries a starting FEN or validates a FEN before invoking fsf_init or creating a board—an expected first step when discovering available variants—the global map is still empty and this dereference is undefined and will crash. These functions should either call fsf_init (or check Board::sfInitialized) before touching variants.

Useful? React with 👍 / 👎.

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