Skip to content

mlconfig: fix crash in width buttons on the font tab - #182

Merged
arakiken merged 1 commit into
arakiken:masterfrom
shitamo:fix-mlconfig-specify-width-atoi
Oct 18, 2026
Merged

arakiken merged 1 commit into
arakiken:masterfrom
shitamo:fix-mlconfig-specify-width-atoi

Conversation

@shitamo

@shitamo shitamo commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix a segmentation fault in mlconfig when clicking font width buttons (widen/narrow/default) for font names that contain a : character.

Cause of Bug

In specify_width(), the :<percent> suffix was located using cp = strrchr(fontname, ':'), but it was parsed using atoi(p + 1). At that point in execution, p was uninitialized (often NULL).

When a font name contained :, pressing any of the width buttons passed p = NULL to atoi(), leading to a crash (segfault at address 1 inside strtol).

Fix

Changed the parser to parse the ratio from cp instead of the uninitialized pointer p.

specify_width() located the ':<percent>' suffix with
cp = strrchr(fontname, ':') but then parsed it with atoi(p + 1),
where p is still uninitialized at that point. Pressing the
widen/narrow/default width buttons with a font name containing ':'
crashed mlconfig (segfault at address 1 inside strtol when p
happened to be NULL). Parse from cp instead.
@arakiken
arakiken merged commit 46cbbc9 into arakiken:master Oct 18, 2026
16 checks passed
@arakiken

Copy link
Copy Markdown
Owner

Thank you.

@shitamo
shitamo deleted the fix-mlconfig-specify-width-atoi branch October 18, 2026 14:35
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.

2 participants