@@ -167,7 +167,11 @@ custom_serializer_walk( void * _self,
167
167
break ;
168
168
}
169
169
case FD_FLAMENCO_TYPE_CSTR :
170
- fprintf ( file , "'%s'," , (char const * )arg );
170
+ if ( arg == NULL ) {
171
+ fprintf ( file , "," );
172
+ } else {
173
+ fprintf ( file , "'%s'," , (char const * )arg );
174
+ }
171
175
break ;
172
176
case FD_FLAMENCO_TYPE_ENUM_DISC : {
173
177
char lowercase_variant [128 ];
@@ -182,7 +186,7 @@ custom_serializer_walk( void * _self,
182
186
default :
183
187
FD_LOG_CRIT (( "unknown type %#x" , (uint )type ));
184
188
break ;
185
- }
189
+ }
186
190
}
187
191
188
192
static int
@@ -200,7 +204,7 @@ fd_runtime_fuzz_decode_type_run( fd_runtime_fuzz_runner_t * runner,
200
204
201
205
// First byte is the type ID
202
206
uchar type_id = input [0 ];
203
- if ( type_id >= FD_TYPE_NAME_COUNT ) {
207
+ if ( type_id >= FD_TYPE_NAME_COUNT ) {
204
208
FD_LOG_WARNING (( "Invalid type ID: %d" , type_id ));
205
209
* output_sz = 0 ;
206
210
return 0 ;
@@ -277,7 +281,6 @@ fd_runtime_fuzz_decode_type_run( fd_runtime_fuzz_runner_t * runner,
277
281
* output_sz = 0 ;
278
282
return 0 ;
279
283
}
280
-
281
284
long serialized_sz = ftell ( file );
282
285
fclose ( file );
283
286
@@ -324,11 +327,11 @@ fd_runtime_fuzz_decode_type_run( fd_runtime_fuzz_runner_t * runner,
324
327
}
325
328
326
329
ulong
327
- fd_runtime_fuzz_type_run ( fd_runtime_fuzz_runner_t * runner ,
328
- void const * input_ ,
329
- void * * output_ ,
330
- void * output_buf ,
331
- ulong output_bufsz ) {
330
+ fd_runtime_fuzz_type_run ( fd_runtime_fuzz_runner_t * runner ,
331
+ void const * input_ ,
332
+ void * * output_ ,
333
+ void * output_buf ,
334
+ ulong output_bufsz ) {
332
335
fd_exec_test_type_context_t const * input = fd_type_pun_const ( input_ );
333
336
fd_exec_test_type_effects_t * * output = fd_type_pun ( output_ );
334
337
@@ -356,24 +359,23 @@ fd_runtime_fuzz_type_run( fd_runtime_fuzz_runner_t * runner,
356
359
effects -> yaml = NULL ;
357
360
358
361
// Decode the type
359
- ulong max_content_size = output_bufsz - (_l - (ulong )output_buf );
360
- uchar * temp_buffer = FD_SCRATCH_ALLOC_APPEND ( l , alignof( uchar ), max_content_size ) ;
362
+ ulong max_content_size = output_bufsz - (_l - (ulong )output_buf );
363
+ uchar * temp_buffer = ( uchar * ) _l ;
361
364
if (FD_UNLIKELY (_l > output_end )) {
362
365
return 0UL ;
363
366
}
364
367
365
368
ulong decoded_sz = max_content_size ;
366
- int success = fd_runtime_fuzz_decode_type_run (
367
- runner ,
368
- input -> content -> bytes ,
369
- input -> content -> size ,
370
- temp_buffer ,
371
- & decoded_sz );
369
+ int success = fd_runtime_fuzz_decode_type_run ( runner ,
370
+ input -> content -> bytes ,
371
+ input -> content -> size ,
372
+ temp_buffer ,
373
+ & decoded_sz );
372
374
373
375
if (!success || decoded_sz == 0 ) {
374
- effects -> result = 0 ;
375
- } else {
376
376
effects -> result = 1 ;
377
+ } else {
378
+ effects -> result = 0 ;
377
379
378
380
// The decoded data contains:
379
381
// - serialized_sz (ulong)
@@ -386,7 +388,7 @@ fd_runtime_fuzz_type_run( fd_runtime_fuzz_runner_t * runner,
386
388
// Allocate and copy the representation (serialized data)
387
389
effects -> representation = FD_SCRATCH_ALLOC_APPEND (l , alignof(pb_bytes_array_t ),
388
390
PB_BYTES_ARRAY_T_ALLOCSIZE (serialized_sz ));
389
- if ( FD_UNLIKELY (_l > output_end ) ) {
391
+ if ( FD_UNLIKELY ( _l > output_end ) ) {
390
392
return 0UL ;
391
393
}
392
394
effects -> representation -> size = (pb_size_t )serialized_sz ;
@@ -396,7 +398,7 @@ fd_runtime_fuzz_type_run( fd_runtime_fuzz_runner_t * runner,
396
398
ulong yaml_sz = decoded_sz - sizeof (ulong ) - serialized_sz ;
397
399
effects -> yaml = FD_SCRATCH_ALLOC_APPEND (l , alignof(pb_bytes_array_t ),
398
400
PB_BYTES_ARRAY_T_ALLOCSIZE (yaml_sz ));
399
- if ( FD_UNLIKELY (_l > output_end ) ) {
401
+ if ( FD_UNLIKELY ( _l > output_end ) ) {
400
402
return 0UL ;
401
403
}
402
404
effects -> yaml -> size = (pb_size_t )yaml_sz ;
0 commit comments