@@ -201,6 +201,9 @@ dump_vote_accounts( fd_exec_slot_ctx_t const * slot_ctx,
201
201
fd_exec_test_vote_account_t * vote_account_out = fd_spad_alloc ( spad ,
202
202
alignof(fd_exec_test_vote_account_t ),
203
203
vote_account_t_cnt * sizeof (fd_exec_test_vote_account_t ) );
204
+ if ( FD_UNLIKELY ( NULL == vote_account_out ) ) {
205
+ FD_LOG_CRIT (( "out of spad scratch space" ));
206
+ }
204
207
205
208
for ( fd_vote_accounts_pair_global_t_mapnode_t const * curr = fd_vote_accounts_pair_global_t_map_minimum_const (
206
209
vote_accounts_pool ,
@@ -270,6 +273,9 @@ dump_sanitized_transaction( fd_funk_t * funk,
270
273
fd_acct_addr_t const * account_keys = fd_txn_get_acct_addrs ( txn_descriptor , txn_payload );
271
274
for ( ulong i = 0 ; i < txn_descriptor -> acct_addr_cnt ; i ++ ) {
272
275
pb_bytes_array_t * account_key = fd_spad_alloc ( spad , alignof(pb_bytes_array_t ), PB_BYTES_ARRAY_T_ALLOCSIZE (sizeof (fd_pubkey_t )) );
276
+ if ( FD_UNLIKELY ( NULL == account_key ) ) {
277
+ FD_LOG_ERR (( "fd_spad_alloc failed" ));
278
+ }
273
279
account_key -> size = sizeof (fd_pubkey_t );
274
280
memcpy ( account_key -> bytes , & account_keys [i ], sizeof (fd_pubkey_t ) );
275
281
message -> account_keys [i ] = account_key ;
@@ -278,6 +284,10 @@ dump_sanitized_transaction( fd_funk_t * funk,
278
284
/* Transaction Context -> tx -> message -> recent_blockhash */
279
285
uchar const * recent_blockhash = fd_txn_get_recent_blockhash ( txn_descriptor , txn_payload );
280
286
message -> recent_blockhash = fd_spad_alloc ( spad , alignof(pb_bytes_array_t ), PB_BYTES_ARRAY_T_ALLOCSIZE (sizeof (fd_hash_t )) );
287
+ if ( FD_UNLIKELY ( NULL == message -> recent_blockhash ) ) {
288
+ FD_LOG_ERR (( "spad_alloc_alloc failed" ));
289
+ }
290
+
281
291
message -> recent_blockhash -> size = sizeof (fd_hash_t );
282
292
memcpy ( message -> recent_blockhash -> bytes , recent_blockhash , sizeof (fd_hash_t ) );
283
293
@@ -354,6 +364,9 @@ dump_sanitized_transaction( fd_funk_t * funk,
354
364
fd_ed25519_sig_t const * signatures = fd_txn_get_signatures ( txn_descriptor , txn_payload );
355
365
for ( uchar i = 0 ; i < txn_descriptor -> signature_cnt ; ++ i ) {
356
366
pb_bytes_array_t * signature = fd_spad_alloc ( spad , alignof(pb_bytes_array_t ), PB_BYTES_ARRAY_T_ALLOCSIZE (sizeof (fd_ed25519_sig_t )) );
367
+ if ( FD_UNLIKELY ( NULL == signature ) ) {
368
+ FD_LOG_ERR (( "fd_spad_alloc failed" ));
369
+ }
357
370
signature -> size = sizeof (fd_ed25519_sig_t );
358
371
memcpy ( signature -> bytes , & signatures [i ], sizeof (fd_ed25519_sig_t ) );
359
372
sanitized_transaction -> signatures [i ] = signature ;
@@ -375,6 +388,9 @@ dump_blockhash_queue( fd_blockhashes_t const * queue,
375
388
iter = fd_blockhash_deq_iter_prev ( queue -> d .deque , iter ) ) {
376
389
fd_blockhash_info_t const * ele = fd_blockhash_deq_iter_ele_const ( queue -> d .deque , iter );
377
390
pb_bytes_array_t * output_blockhash = fd_spad_alloc ( spad , alignof(pb_bytes_array_t ), PB_BYTES_ARRAY_T_ALLOCSIZE (sizeof (fd_hash_t )) );
391
+ if ( FD_UNLIKELY ( NULL == output_blockhash ) ) {
392
+ FD_LOG_ERR (( "fd_spad_alloc failed" ));
393
+ }
378
394
output_blockhash -> size = sizeof (fd_hash_t );
379
395
fd_memcpy ( output_blockhash -> bytes , & ele -> hash , sizeof (fd_hash_t ) );
380
396
output_blockhash_queue [ cnt ] = output_blockhash ;
@@ -577,6 +593,9 @@ create_block_context_protobuf_from_block_tx_only( fd_exec_test_block_context_t *
577
593
/* BlockContext -> txns */
578
594
block_context -> txns_count = 0U ;
579
595
block_context -> txns = fd_spad_alloc ( spad , alignof(fd_exec_test_sanitized_transaction_t ), block_info -> txn_cnt * sizeof (fd_exec_test_sanitized_transaction_t ) );
596
+ if ( FD_UNLIKELY ( NULL == block_context -> txns ) ) {
597
+ FD_LOG_ERR (( "fd_spad_alloc failed" ));
598
+ }
580
599
fd_memset ( block_context -> txns , 0 , block_info -> txn_cnt * sizeof (fd_exec_test_sanitized_transaction_t ) );
581
600
582
601
/* BlockContext -> acct_states
@@ -1041,6 +1060,10 @@ fd_dump_block_to_protobuf_tx_only( fd_runtime_block_info_t const * block_info,
1041
1060
/* Output to file */
1042
1061
ulong out_buf_size = 5UL <<30UL ; /* 5 GB */
1043
1062
uint8_t * out = fd_spad_alloc ( spad , alignof(uint8_t ), out_buf_size );
1063
+ if ( FD_UNLIKELY ( NULL == out ) ) {
1064
+ FD_LOG_CRIT (( "out of spad scratch space" ));
1065
+ }
1066
+
1044
1067
pb_ostream_t stream = pb_ostream_from_buffer ( out , out_buf_size );
1045
1068
if ( pb_encode ( & stream , FD_EXEC_TEST_BLOCK_CONTEXT_FIELDS , block_context_msg ) ) {
1046
1069
char output_filepath [256 ]; fd_memset ( output_filepath , 0 , sizeof (output_filepath ) );
@@ -1092,6 +1115,9 @@ FD_SPAD_FRAME_BEGIN( vm->instr_ctx->txn_ctx->spad ) {
1092
1115
1093
1116
/* SyscallContext -> vm_ctx -> rodata */
1094
1117
sys_ctx .vm_ctx .rodata = fd_spad_alloc ( vm -> instr_ctx -> txn_ctx -> spad , alignof(pb_bytes_array_t ), PB_BYTES_ARRAY_T_ALLOCSIZE ( vm -> rodata_sz ) );
1118
+ if ( FD_UNLIKELY ( NULL == sys_ctx .vm_ctx .rodata )) {
1119
+ FD_LOG_ERR (( "fd_spad_alloc failed " ));
1120
+ }
1095
1121
sys_ctx .vm_ctx .rodata -> size = (pb_size_t ) vm -> rodata_sz ;
1096
1122
fd_memcpy ( sys_ctx .vm_ctx .rodata -> bytes , vm -> rodata , vm -> rodata_sz );
1097
1123
@@ -1123,11 +1149,17 @@ FD_SPAD_FRAME_BEGIN( vm->instr_ctx->txn_ctx->spad ) {
1123
1149
1124
1150
/* SyscallContext -> vm_ctx -> return_data -> data */
1125
1151
sys_ctx .vm_ctx .return_data .data = fd_spad_alloc ( vm -> instr_ctx -> txn_ctx -> spad , alignof(pb_bytes_array_t ), PB_BYTES_ARRAY_T_ALLOCSIZE ( vm -> instr_ctx -> txn_ctx -> return_data .len ) );
1152
+ if ( FD_UNLIKELY ( NULL == sys_ctx .vm_ctx .return_data .data )) {
1153
+ FD_LOG_ERR (( "fd_spad_alloc failed " ));
1154
+ }
1126
1155
sys_ctx .vm_ctx .return_data .data -> size = (pb_size_t )vm -> instr_ctx -> txn_ctx -> return_data .len ;
1127
1156
fd_memcpy ( sys_ctx .vm_ctx .return_data .data -> bytes , vm -> instr_ctx -> txn_ctx -> return_data .data , vm -> instr_ctx -> txn_ctx -> return_data .len );
1128
1157
1129
1158
/* SyscallContext -> vm_ctx -> return_data -> program_id */
1130
1159
sys_ctx .vm_ctx .return_data .program_id = fd_spad_alloc ( vm -> instr_ctx -> txn_ctx -> spad , alignof(pb_bytes_array_t ), sizeof (fd_pubkey_t ) );
1160
+ if ( FD_UNLIKELY ( NULL == sys_ctx .vm_ctx .return_data .program_id )) {
1161
+ FD_LOG_ERR (( "fd_spad_alloc failed " ));
1162
+ }
1131
1163
sys_ctx .vm_ctx .return_data .program_id -> size = sizeof (fd_pubkey_t );
1132
1164
fd_memcpy ( sys_ctx .vm_ctx .return_data .program_id -> bytes , vm -> instr_ctx -> txn_ctx -> return_data .program_id .key , sizeof (fd_pubkey_t ) );
1133
1165
@@ -1227,6 +1259,9 @@ FD_SPAD_FRAME_BEGIN( txn_ctx->spad ) {
1227
1259
/* Output to file */
1228
1260
ulong out_buf_size = 1UL <<29UL ; /* 128 MB */
1229
1261
uint8_t * out = fd_spad_alloc ( txn_ctx -> spad , alignof(uint8_t ), out_buf_size );
1262
+ if ( FD_UNLIKELY ( NULL == out ) ) {
1263
+ FD_LOG_CRIT (( "out of spad scratch space" ));
1264
+ }
1230
1265
pb_ostream_t stream = pb_ostream_from_buffer ( out , out_buf_size );
1231
1266
if ( pb_encode ( & stream , FD_EXEC_TEST_ELF_LOADER_CTX_FIELDS , & elf_ctx ) ) {
1232
1267
FILE * file = fopen (filename , "wb" );
0 commit comments