Skip to content
/ server Public

MDEV-37952: Fix crash when setting mroonga_default_tokenizer to NULL#4606

Open
hadeer-r wants to merge 3 commits intoMariaDB:mainfrom
hadeer-r:MDEV-37952
Open

MDEV-37952: Fix crash when setting mroonga_default_tokenizer to NULL#4606
hadeer-r wants to merge 3 commits intoMariaDB:mainfrom
hadeer-r:MDEV-37952

Conversation

@hadeer-r
Copy link

@hadeer-r hadeer-r commented Feb 1, 2026

Summary

  • This PR fixes a SIGSEGV crash occurring when the system variable mroonga_default_tokenizer is set to NULL. The fix introduces a safety check to handle NULL values gracefully by treating them as an "off" state, preventing invalid memory access during string comparison.

  • The crash was rooted in the update function for the mroonga_default_tokenizer variable. It lacked a validation step for NULL inputs before passing the value to strcmp().


Key Changes:

  • Added a check for NULL pointers in the variable assignment logic.
  • Mapped NULL input to the "off" behavior to allow users to reset the tokenizer safely without crashing the server.
  • Added mtr test to validate behavior when setting mroonga_default_tokenizer to null

Fix: MDEV-37952

@CLAassistant
Copy link

CLAassistant commented Feb 1, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

Setting mroonga_default_tokenizer to NULL caused a server
crash because the update function did not handle the NULL value before
passing it to strcmp.

Handle NULL values by treating them as "off" to allow safe variable
reset.
@hadeer-r
Copy link
Author

hadeer-r commented Feb 2, 2026

I have applied the feedback to use DEFAULT and empty line formatting.

@vuvova vuvova requested a review from gkodinov February 2, 2026 11:35
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Feb 3, 2026
kou added a commit to mroonga/mroonga that referenced this pull request Feb 5, 2026
- This PR fixes a SIGSEGV crash occurring when the system variable
mroonga_default_tokenizer is set to NULL.
- The crash was caused by passing a NULL pointer to strcmp() in the
update function of the mroonga_default_tokenizer variable.

**Changes**
- Mapped NULL input to "off" behavior.
- Included a test case to verify the fix.

This is the same fix I submitted to MariaDB here:
MariaDB/server#4606

---------

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
hadeer-r and others added 2 commits February 7, 2026 13:02
Align with existing mroonga memory management patterns to ensure consistency,
rather than relying on the MariaDB framework default behavior.
@hadeer-r
Copy link
Author

hadeer-r commented Feb 7, 2026

Hi, I have applied the manual allocation changes for new_value in mrn_default_tokenizer_update as discussed, aligning with the memory management pattern used in the previous Mroonga PR.

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

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

4 participants