Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.12] gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (GH-123263) #123265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[3.12] gh-123229: Fix valgrind warning by initializing the f-string b…
…uffers to 0 in the tokenizer (GH-123263)

(cherry picked from commit adc5190)

Co-authored-by: Pablo Galindo Salgado <[email protected]>
Signed-off-by: Pablo Galindo <[email protected]>
  • Loading branch information
pablogsal committed Aug 23, 2024
commit 3b7eeefb94c517b61e40ce5575a35b116caed02c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix valgrind warning by initializing the f-string buffers to 0 in the
tokenizer. Patch by Pablo Galindo
2 changes: 1 addition & 1 deletion Parser/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static const char *type_comment_prefix = "# type: ";

static struct tok_state *tok_new(void) {
struct tok_state *tok =
(struct tok_state *)PyMem_Malloc(sizeof(struct tok_state));
(struct tok_state *)PyMem_Calloc(1, sizeof(struct tok_state));
if (tok == NULL)
return NULL;
tok->buf = tok->cur = tok->inp = NULL;
Expand Down
13 changes: 13 additions & 0 deletions lel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 3118fb19846..9e0dee8cc38 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -65,7 +65,7 @@ static const char *type_comment_prefix = "# type: ";

static struct tok_state *tok_new(void) {
struct tok_state *tok =
- (struct tok_state *)PyMem_Malloc(sizeof(struct tok_state));
+ (struct tok_state *)PyMem_Calloc(1, sizeof(struct tok_state));
if (tok == NULL)
return NULL;
tok->buf = tok->cur = tok->inp = NULL;
Loading