Skip to content
/ server Public

Comments

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

Merged
vuvova merged 4 commits intoMariaDB:10.6from
hadeer-r:MDEV-37952
Feb 12, 2026
Merged

MDEV-37952: Fix crash when setting mroonga_default_tokenizer to NULL#4606
vuvova merged 4 commits intoMariaDB:10.6from
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

@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
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.

Copy link
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! This is a preliminary review.

Copy link
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

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

The preliminary review is now done. Please wait for the final review.

@gkodinov gkodinov enabled auto-merge (rebase) February 10, 2026 11:42
@gkodinov
Copy link
Member

for the record: the review from the domain experts for this codebase are good enough. Will push (after checking with @vuvova).

@gkodinov gkodinov disabled auto-merge February 10, 2026 13:19
@gkodinov gkodinov enabled auto-merge (rebase) February 10, 2026 14:30
@vuvova vuvova disabled auto-merge February 11, 2026 12:01
Copy link
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

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

One last thing before we merge this: Can you re-base to 10.6 please? This is a crashing bug and the jira says it applies to 10.6 onwards.

@hadeer-r
Copy link
Author

sure, I will rebase it now

@hadeer-r
Copy link
Author

I noticed that rebasing onto 10.6 is trying to replay the entire history (over 3000 commits) because my branch was based on a newer version.

My plan is to create a fresh branch from 10.6, cherry-pick only my specific commits, and then force push to update this PR. Does this approach look good?

@gkodinov
Copy link
Member

I noticed that rebasing onto 10.6 is trying to replay the entire history (over 3000 commits) because my branch was based on a newer version.

My plan is to create a fresh branch from 10.6, cherry-pick only my specific commits, and then force push to update this PR. Does this approach look good?

Yes, that is the easiest way indeed.

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.
Align with existing mroonga memory management patterns to ensure consistency,
rather than relying on the MariaDB framework default behavior.
Add copyright header to the test file.
Disable the test in embedded mode by sourcing include/not_embedded.inc."
@hadeer-r hadeer-r changed the base branch from main to 10.6 February 11, 2026 15:01
@hadeer-r
Copy link
Author

I noticed the AppVeyor CI check is failing with:AppVeyor was unable to build non-mergeable pull request

I've rebased my branch on top of the latest 10.6 and verified locally that there are no merge conflicts.
Could this be a temporary glitch on GitHub's side, or is there something else I should check?

@vuvova vuvova merged commit 2dbd5bb into MariaDB:10.6 Feb 12, 2026
13 checks passed
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.

5 participants