https://github.com/python/cpython/commit/935b8b422b801f8c6a6ac35f5f2493f05279ae9e
commit: 935b8b422b801f8c6a6ac35f5f2493f05279ae9e
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: pablogsal <[email protected]>
date: 2024-08-23T12:59:54Z
summary:

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

gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in 
the tokenizer (GH-123263)
(cherry picked from commit adc5190014efcf7b7a4c5dfc9998faa8345527ed)

Signed-off-by: Pablo Galindo <[email protected]>
Co-authored-by: Pablo Galindo Salgado <[email protected]>

files:
A Misc/NEWS.d/next/Core and 
Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst
M Parser/lexer/state.c

diff --git a/Misc/NEWS.d/next/Core and 
Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst b/Misc/NEWS.d/next/Core 
and Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst
new file mode 100644
index 00000000000000..aa9e8d1fa93bf5
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and 
Builtins/2024-08-23-13-08-27.gh-issue-123229.aHm-dw.rst 
@@ -0,0 +1,2 @@
+Fix valgrind warning by initializing the f-string buffers to 0 in the
+tokenizer. Patch by Pablo Galindo
diff --git a/Parser/lexer/state.c b/Parser/lexer/state.c
index 647f291911564c..1665debea30b30 100644
--- a/Parser/lexer/state.c
+++ b/Parser/lexer/state.c
@@ -12,7 +12,8 @@
 struct tok_state *
 _PyTokenizer_tok_new(void)
 {
-    struct tok_state *tok = (struct tok_state *)PyMem_Malloc(
+    struct tok_state *tok = (struct tok_state *)PyMem_Calloc(
+                                            1,
                                             sizeof(struct tok_state));
     if (tok == NULL)
         return NULL;

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to