@@ -660,7 +660,9 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
660
660
read_uint32 (p , p_end , cnt );
661
661
662
662
if (cnt > 0 ) {
663
- module -> native_symbol_list = wasm_runtime_malloc (cnt * sizeof (void * ));
663
+ uint64 list_size = cnt * (uint64 )sizeof (void * );
664
+ module -> native_symbol_list =
665
+ loader_malloc (list_size , error_buf , error_buf_size );
664
666
if (module -> native_symbol_list == NULL ) {
665
667
set_error_buf (error_buf , error_buf_size ,
666
668
"malloc native symbol list failed" );
@@ -669,6 +671,9 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
669
671
670
672
for (i = cnt - 1 ; i >= 0 ; i -- ) {
671
673
read_string (p , p_end , symbol );
674
+ if (!strlen (symbol ))
675
+ continue ;
676
+
672
677
if (!strncmp (symbol , "f32#" , 4 ) || !strncmp (symbol , "i32#" , 4 )) {
673
678
uint32 u32 ;
674
679
/* Resolve the raw int bits of f32 const */
@@ -698,7 +703,7 @@ load_native_symbol_section(const uint8 *buf, const uint8 *buf_end,
698
703
else {
699
704
module -> native_symbol_list [i ] =
700
705
get_native_symbol_by_name (symbol );
701
- if (module -> native_symbol_list [i ] == NULL ) {
706
+ if (! module -> native_symbol_list [i ]) {
702
707
set_error_buf_v (error_buf , error_buf_size ,
703
708
"missing native symbol: %s" , symbol );
704
709
goto fail ;
0 commit comments