mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-31 05:11:19 +00:00 
			
		
		
		
	loader: Sub local count can be 0 (#1504)
Sub local count is allowed to be 0 in each group of function local types.
This commit is contained in:
		
							parent
							
								
									046f5f2212
								
							
						
					
					
						commit
						64c0b15c52
					
				|  | @ -1950,8 +1950,8 @@ load_function_section(const uint8 *buf, const uint8 *buf_end, | |||
|             local_type_index = 0; | ||||
|             for (j = 0; j < local_set_count; j++) { | ||||
|                 read_leb_uint32(p_code, buf_code_end, sub_local_count); | ||||
|                 if (!sub_local_count | ||||
|                     || local_type_index > UINT32_MAX - sub_local_count | ||||
|                 /* Note: sub_local_count is allowed to be 0 */ | ||||
|                 if (local_type_index > UINT32_MAX - sub_local_count | ||||
|                     || local_type_index + sub_local_count > local_count) { | ||||
|                     set_error_buf(error_buf, error_buf_size, | ||||
|                                   "invalid local count"); | ||||
|  |  | |||
|  | @ -1013,8 +1013,8 @@ load_function_section(const uint8 *buf, const uint8 *buf_end, | |||
|             local_type_index = 0; | ||||
|             for (j = 0; j < local_set_count; j++) { | ||||
|                 read_leb_uint32(p_code, buf_code_end, sub_local_count); | ||||
|                 bh_assert(sub_local_count | ||||
|                           && local_type_index <= UINT32_MAX - sub_local_count | ||||
|                 /* Note: sub_local_count is allowed to be 0 */ | ||||
|                 bh_assert(local_type_index <= UINT32_MAX - sub_local_count | ||||
|                           && local_type_index + sub_local_count <= local_count); | ||||
| 
 | ||||
|                 CHECK_BUF(p_code, buf_code_end, 1); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Wenyong Huang
						Wenyong Huang