From: Pablo Galindo Salgado Date: Fri, 23 Aug 2024 13:04:25 +0000 (+0100) Subject: [3.12] gh-123229: Fix valgrind warning by initializing the f-string buffers to 0... X-Git-Tag: v3.12.6~57 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7dec3d7acbb072e0d5cd7357c1ddf12d3c667e8a;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-123229: Fix valgrind warning by initializing the f-string buffers to 0 in the tokenizer (GH-123263) (#123265) (cherry picked from commit adc5190014efcf7b7a4c5dfc9998faa8345527ed) Signed-off-by: Pablo Galindo --- 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 000000000000..aa9e8d1fa93b --- /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/tokenizer.c b/Parser/tokenizer.c index 3118fb198465..9e0dee8cc383 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; diff --git a/lel.patch b/lel.patch new file mode 100644 index 000000000000..c525a7a00a9d --- /dev/null +++ b/lel.patch @@ -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;