@@ -115,14 +115,17 @@ parser_error_t read_structured_display_overrides(parser_context_t *ctx, structur
115115 CHECK_INPUT (ctx );
116116
117117 // read has_title_elements
118- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& display -> has_title_elements ));
118+ uint8_t tmp = 0 ;
119+ CHECK_ERROR (read_u8 (ctx , & tmp ));
120+ display -> has_title_elements = (tmp != 0 );
119121 if (display -> has_title_elements ) {
120122 // read title_elements
121123 CHECK_ERROR (read_u64 (ctx , (uint64_t * )& display -> title_elements ));
122124 }
123125
124126 // read has_title_lines
125- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& display -> has_title_lines ));
127+ CHECK_ERROR (read_u8 (ctx , & tmp ));
128+ display -> has_title_lines = (tmp != 0 );
126129 if (display -> has_title_lines ) {
127130 // read title_lines
128131 CHECK_ERROR (read_u64 (ctx , (uint64_t * )& display -> title_lines ));
@@ -155,7 +158,9 @@ parser_error_t read_primitive_byte_array(parser_context_t *ctx, primitive_byte_a
155158 CHECK_ERROR (read_byte_display (ctx , & primitive -> display ));
156159
157160 // read has_name_registry
158- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& primitive -> has_name_registry ));
161+ uint8_t tmp = 0 ;
162+ CHECK_ERROR (read_u8 (ctx , & tmp ));
163+ primitive -> has_name_registry = (tmp != 0 );
159164
160165 // read name_registry
161166 if (primitive -> has_name_registry ) {
@@ -177,7 +182,9 @@ parser_error_t read_primitive_byte_vec(parser_context_t *ctx, primitive_byte_vec
177182 CHECK_ERROR (read_byte_display (ctx , & primitive -> display ));
178183
179184 // read has_name_registry
180- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& primitive -> has_name_registry ));
185+ uint8_t tmp = 0 ;
186+ CHECK_ERROR (read_u8 (ctx , & tmp ));
187+ primitive -> has_name_registry = (tmp != 0 );
181188
182189 // read name_registry
183190 if (primitive -> has_name_registry ) {
@@ -269,7 +276,9 @@ parser_error_t read_enum_variant(parser_context_t *ctx, enum_variant_t *variant)
269276 CHECK_ERROR (read_u8 (ctx , (uint8_t * )& variant -> hide_tag ));
270277
271278 // read has_value
272- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& variant -> has_value ));
279+ uint8_t tmp = 0 ;
280+ CHECK_ERROR (read_u8 (ctx , & tmp ));
281+ variant -> has_value = (tmp != 0 );
273282 if (variant -> has_value ) {
274283 // read value
275284 CHECK_ERROR (read_link (ctx , & variant -> value ));
@@ -374,7 +383,9 @@ parser_error_t read_struct(parser_context_t *ctx, schema_struct_t *schema_struct
374383 }
375384
376385 // read has_show_as
377- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& schema_struct -> has_show_as ));
386+ uint8_t tmp = 0 ;
387+ CHECK_ERROR (read_u8 (ctx , & tmp ));
388+ schema_struct -> has_show_as = (tmp != 0 );
378389 if (schema_struct -> has_show_as ) {
379390 CHECK_ERROR (read_u32 (ctx , (uint32_t * )& schema_struct -> show_as .len ));
380391 if (schema_struct -> show_as .len == 0 ) {
@@ -387,7 +398,8 @@ parser_error_t read_struct(parser_context_t *ctx, schema_struct_t *schema_struct
387398 }
388399
389400 // read has_structured_show_as
390- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& schema_struct -> has_structured_show_as ));
401+ CHECK_ERROR (read_u8 (ctx , & tmp ));
402+ schema_struct -> has_structured_show_as = (tmp != 0 );
391403 if (schema_struct -> has_structured_show_as ) {
392404 CHECK_ERROR (read_u32 (ctx , (uint32_t * )& schema_struct -> structured_show_as .len ));
393405 if (schema_struct -> structured_show_as .len == 0 ) {
@@ -424,7 +436,9 @@ parser_error_t read_tuple(parser_context_t *ctx, schema_tuple_t *schema_tuple) {
424436 CHECK_INPUT (ctx );
425437
426438 // read has_show_as
427- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& schema_tuple -> has_show_as ));
439+ uint8_t tmp = 0 ;
440+ CHECK_ERROR (read_u8 (ctx , & tmp ));
441+ schema_tuple -> has_show_as = (tmp != 0 );
428442 if (schema_tuple -> has_show_as ) {
429443 CHECK_ERROR (read_u32 (ctx , (uint32_t * )& schema_tuple -> show_as .len ));
430444 if (schema_tuple -> show_as .len == 0 ) {
@@ -437,7 +451,8 @@ parser_error_t read_tuple(parser_context_t *ctx, schema_tuple_t *schema_tuple) {
437451 }
438452
439453 // read has_structured_show_as
440- CHECK_ERROR (read_u8 (ctx , (uint8_t * )& schema_tuple -> has_structured_show_as ));
454+ CHECK_ERROR (read_u8 (ctx , & tmp ));
455+ schema_tuple -> has_structured_show_as = (tmp != 0 );
441456 if (schema_tuple -> has_structured_show_as ) {
442457 CHECK_ERROR (read_u32 (ctx , (uint32_t * )& schema_tuple -> structured_show_as .len ));
443458 if (schema_tuple -> structured_show_as .len == 0 ) {
@@ -762,6 +777,10 @@ parser_error_t schema_merkle_proofs_read(parser_context_t *ctx, parser_tx_t *txO
762777 CHECK_INPUT (ctx );
763778 CHECK_INPUT (txObj );
764779
780+ if (ctx -> buffer .len < 4 ) {
781+ return parser_no_data ;
782+ }
783+
765784 // read leaf data
766785 CHECK_ERROR (read_u32 (ctx , & txObj -> merkle_proof .leaves .entries ));
767786 const uint8_t * ptr_mem = ctx -> buffer .ptr + ctx -> offset ;
0 commit comments