asan: NULL deref in filter_symbols

Message ID Y34R4z7auiQd9V9m@squeak.grove.modra.org
State Repeat Merge
Headers
Series asan: NULL deref in filter_symbols |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Alan Modra Nov. 23, 2022, 12:28 p.m. UTC
  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.
  

Patch

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 asect)
  error_return:
   if (symbols)
     bfd_release (abfd, symbols);
+  tdata->symcount = 0;
   return false;
 }