From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1062) id B6FCB3853D5E; Wed, 23 Nov 2022 12:29:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B6FCB3853D5E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Alan Modra To: bfd-cvs@sourceware.org Subject: [binutils-gdb] asan: NULL deref in filter_symbols X-Act-Checkin: binutils-gdb X-Git-Author: Alan Modra X-Git-Refname: refs/heads/master X-Git-Oldrev: 8181f0045df765a7f28db745f4a8bd3c5a1da82d X-Git-Newrev: d499fb89448c3f2e061813f12a1b63fbaa29422e Message-Id: <20221123122938.B6FCB3853D5E@sourceware.org> Date: Wed, 23 Nov 2022 12:29:38 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Nov 2022 12:29:38 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd499fb89448c= 3f2e061813f12a1b63fbaa29422e commit d499fb89448c3f2e061813f12a1b63fbaa29422e Author: Alan Modra Date: Wed Nov 23 22:07:03 2022 +1030 asan: NULL deref in filter_symbols =20 If tdata->symbols is NULL, make tdata->symcount zero too. This makes wasm_get_symtab_upper_bound return the proper result and stops cascading errors. =20 * wasm-module.c (wasm_scan_name_function_section): Clear tdata->symcount on error. Diff: --- bfd/wasm-module.c | 1 + 1 file changed, 1 insertion(+) diff --git a/bfd/wasm-module.c b/bfd/wasm-module.c index 2c2c6c72863..c96665b6e91 100644 --- a/bfd/wasm-module.c +++ b/bfd/wasm-module.c @@ -359,6 +359,7 @@ wasm_scan_name_function_section (bfd *abfd, sec_ptr ase= ct) error_return: if (symbols) bfd_release (abfd, symbols); + tdata->symcount =3D 0; return false; }