From 444250a5e79180e96cf1c8c2716d35a6cde185c9 Mon Sep 17 00:00:00 2001 From: Patrick Lerda Date: Tue, 28 Feb 2023 17:49:14 +0100 Subject: [PATCH] mesa/program: fix memory leak triggered by invalid extended swizzle selector MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For instance, with "piglit/bin/asmparsertest ARBfp1.0 tests/asmparsertest/shaders/ARBfp1.0/swz-04.txt": Direct leak of 18 byte(s) in 2 object(s) allocated from: #0 0x7f97e99050 in __interceptor_strdup (/usr/lib64/libasan.so.6+0x59050) #1 0x7f8d4160ac in handle_ident ../src/mesa/program/program_lexer.l:129 #2 0x7f8d4160ac in _mesa_program_lexer_lex ../src/mesa/program/program_lexer.l:312 #3 0x7f8d402b50 in yylex ../src/mesa/program/program_parse.y:289 #4 0x7f8d402b50 in yyparse src/mesa/program/program_parse.tab.c:2140 #5 0x7f8d40d01c in _mesa_parse_arb_program ../src/mesa/program/program_parse.y:2590 #6 0x7f8d3f77ac in _mesa_parse_arb_fragment_program ../src/mesa/program/arbprogparse.c:82 #7 0x7f8d3ad468 in set_program_string ../src/mesa/main/arbprogram.c:402 Signed-off-by: Patrick Lerda Reviewed-by: Marek Olšák Part-of: --- src/mesa/program/program_parse.y | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index ba4757f..0f5fdcb 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -684,6 +684,7 @@ extSwizSel: INTEGER if (strlen($1) > 1) { yyerror(& @1, state, "invalid extended swizzle selector"); + free($1); YYERROR; } -- 2.7.4