mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 13:17:31 +00:00 
			
		
		
		
	Fix issue of resolving func name in custom name section (#1849)
Should use import_function_count but not import_count to calculate the func_index in handle_name_section when custom name section feature is enabled. And clear the compile warnings of mini loader.
This commit is contained in:
		
							parent
							
								
									d1fe589d43
								
							
						
					
					
						commit
						0090d3e3fc
					
				|  | @ -2806,8 +2806,8 @@ handle_name_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module, | |||
|                         read_leb_uint32(p, p_end, func_name_len); | ||||
|                         CHECK_BUF(p, p_end, func_name_len); | ||||
|                         /* Skip the import functions */ | ||||
|                         if (func_index >= module->import_count) { | ||||
|                             func_index -= module->import_count; | ||||
|                         if (func_index >= module->import_function_count) { | ||||
|                             func_index -= module->import_function_count; | ||||
|                             if (func_index >= module->function_count) { | ||||
|                                 set_error_buf(error_buf, error_buf_size, | ||||
|                                               "out-of-range function index"); | ||||
|  |  | |||
|  | @ -1708,8 +1708,8 @@ handle_name_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module, | |||
|                         read_leb_uint32(p, p_end, func_name_len); | ||||
|                         CHECK_BUF(p, p_end, func_name_len); | ||||
|                         /* Skip the import functions */ | ||||
|                         if (func_index >= module->import_count) { | ||||
|                             func_index -= module->import_count; | ||||
|                         if (func_index >= module->import_function_count) { | ||||
|                             func_index -= module->import_function_count; | ||||
|                             bh_assert(func_index < module->function_count); | ||||
|                             if (!(module->functions[func_index]->field_name = | ||||
|                                       const_str_list_insert( | ||||
|  | @ -1733,6 +1733,8 @@ handle_name_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module, | |||
|         i++; | ||||
|     } | ||||
| 
 | ||||
|     (void)previous_name_type; | ||||
|     (void)previous_func_index; | ||||
|     return true; | ||||
| } | ||||
| #endif | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Wenyong Huang
						Wenyong Huang