Skip to content

gh-150372: add missing null check on completer_word_break_characters in readline.c#150251

Merged
serhiy-storchaka merged 7 commits into
python:mainfrom
KowalskiThomas:kowalski/fix-missing-null-check-on-strdup
May 30, 2026
Merged

gh-150372: add missing null check on completer_word_break_characters in readline.c#150251
serhiy-storchaka merged 7 commits into
python:mainfrom
KowalskiThomas:kowalski/fix-missing-null-check-on-strdup

Conversation

@KowalskiThomas
Copy link
Copy Markdown
Contributor

@KowalskiThomas KowalskiThomas commented May 22, 2026

What is this PR?

This adds a missing null pointer check on the result of an strdup call used to populate completer_word_break_characters. This matches what the remainder of the files does (so I assume this wasn't on purpose / being optimistic about strdup).

@KowalskiThomas KowalskiThomas changed the title fix: missing null check on strdup fix: missing null check on strdup May 22, 2026
@picnixz
Copy link
Copy Markdown
Member

picnixz commented May 23, 2026

Please create both an issue and a NEWS entry and update the PR title. It does not indicate what the change is about and is a poor commit message.

@KowalskiThomas KowalskiThomas changed the title fix: missing null check on strdup gh-150372: add missing null check on strdup May 25, 2026
@KowalskiThomas KowalskiThomas changed the title gh-150372: add missing null check on strdup gh-150372: add missing null check on completer_word_break_characters May 25, 2026
@KowalskiThomas KowalskiThomas marked this pull request as ready for review May 25, 2026 05:22
@KowalskiThomas KowalskiThomas changed the title gh-150372: add missing null check on completer_word_break_characters gh-150372: add missing null check on completer_word_break_characters in readline.c May 25, 2026
Comment thread Modules/readline.c Outdated
leandro4979-hub

This comment was marked as low quality.

@@ -0,0 +1,3 @@
Fix missing null check on the result of :func:`!strdup` in
:mod:`readline` module initialization, preventing a potential null pointer
dereference on memory allocation failure.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
dereference on memory allocation failure.
:mod:`readline`: Fix missing null check on the result of :func:`!strdup`
in module initialization, preventing a potential null pointer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I applied the suggestion but I think it resulted in a borked news entry so I fixed it up myself.

Should be good I believe, I'll let you double check.

Comment thread Modules/readline.c Outdated
@vstinner vstinner added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels May 28, 2026
@KowalskiThomas KowalskiThomas requested a review from vstinner May 29, 2026 16:12
Comment thread Modules/readline.c
Comment thread Misc/NEWS.d/next/Library/2026-05-25-07-22-05.gh-issue-150372.9hLqhe.rst Outdated
Comment thread Modules/readline.c
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. 👍

@serhiy-storchaka serhiy-storchaka merged commit 56bd9ea into python:main May 30, 2026
104 of 106 checks passed
@miss-islington-app
Copy link
Copy Markdown

Thanks @KowalskiThomas for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 30, 2026

GH-150628 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 30, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 30, 2026

GH-150629 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 30, 2026
@bedevere-app
Copy link
Copy Markdown

bedevere-app Bot commented May 30, 2026

GH-150630 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label May 30, 2026
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.

6 participants