asan: NULL deref in filter_symbols
authorAlan Modra <amodra@gmail.com>
Wed, 23 Nov 2022 11:37:03 +0000 (22:07 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 23 Nov 2022 12:08:48 +0000 (22:38 +1030)
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.

* wasm-module.c (wasm_scan_name_function_section): Clear
tdata->symcount on error.

bfd/wasm-module.c

index 2c2c6c7286359ff0b42b0fa857653920730f63ff..c96665b6e91a27266da29242c0016c9a382a8642 100644 (file)
@@ -359,6 +359,7 @@ wasm_scan_name_function_section (bfd *abfd, sec_ptr asect)
  error_return:
   if (symbols)
     bfd_release (abfd, symbols);
+  tdata->symcount = 0;
   return false;
 }