Skip to content

MDEV-35717: UBSAN: runtime error: applying zero offset to null pointer in my_strnncoll_utf8mb3_general1400_as_ci#4910

Merged
raghunandanbhat merged 1 commit into11.8from
11.8-mdev-35717
Apr 16, 2026
Merged

MDEV-35717: UBSAN: runtime error: applying zero offset to null pointer in my_strnncoll_utf8mb3_general1400_as_ci#4910
raghunandanbhat merged 1 commit into11.8from
11.8-mdev-35717

Conversation

@raghunandanbhat
Copy link
Copy Markdown
Contributor

@raghunandanbhat raghunandanbhat commented Apr 7, 2026

fixes MDEV-35717

Problem:

UBSAN reports runtime errors in string comparision functions where pointer arithmetic is done without checking NULL.

  • runtime errors: applying zero offset to null pointer in my_strnncoll_utf8mb3_general1400_as_ci

Fix:

  • Add debug asserts in strnncoll function to catch NULL pointers.
  • Define a new function streq_safe as a replacement for streq, capable of handling NULL pointers. Replace streq with streq_safe at multiple call sites, identified by the debug asserts.
  • Add empty identifier checks in is_infoschema_db and is_perfschema_db before calling the deep character-set based comparison.

@raghunandanbhat raghunandanbhat changed the title MDEV-35717: UBSAN: runtime errors: applying [zero|non-zero] offset to null pointer MDEV-35717: UBSAN: runtime error: applying zero offset to null pointer in my_strnncoll_utf8mb3_general1400_as_ci Apr 13, 2026
@raghunandanbhat raghunandanbhat marked this pull request as ready for review April 13, 2026 11:24
@raghunandanbhat raghunandanbhat force-pushed the 11.8-mdev-35717 branch 4 times, most recently from 02bb33d to 583868f Compare April 15, 2026 10:39
…r in `my_strnncoll_utf8mb3_general1400_as_ci`

Problem:
  UBSAN reports runtime errors in string comparision functions when
  pointer arithmetic is done without checking NULL.

Fix:
  - Add debug asserts in `strnncoll` function to catch NULL pointers.
  - Define a new function `streq_safe` as a replacement for `streq`,
    capable of handling NULL pointers. Replace `streq` with `streq_safe`
    at multiple call sites, identified by the debug asserts.
  - Add empty identifier checks in `is_infoschema_db` and
    `is_perfschema_db` before calling the deep character-set based
    comparision.
Copy link
Copy Markdown
Contributor

@abarkov abarkov left a comment

Choose a reason for hiding this comment

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

The patch is OK to push. Thanks.

@raghunandanbhat raghunandanbhat merged commit 7c1b02c into 11.8 Apr 16, 2026
17 of 18 checks passed
@raghunandanbhat raghunandanbhat deleted the 11.8-mdev-35717 branch April 16, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants