Skip to content

Commit 3902f65

Browse files
anarcheuzjumpsiegel
anarcheuz
authored andcommitted
flamenco: types fuzzer will reject blacklisted types
1 parent 07cd51b commit 3902f65

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/flamenco/types/fuzz_types_decode.c

+15-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,21 @@ LLVMFuzzerTestOneInput( uchar const * data,
177177

178178
/* fd_pubkey is a #define alias for fd_hash. It is therefore already
179179
fuzzed. Furthermore, dlsym will not be able to find a #define. */
180-
if ( FD_UNLIKELY( 0==strcmp( type_meta->name, "fd_pubkey" ) ) ) {
180+
if( FD_UNLIKELY( 0==strcmp( type_meta->name, "fd_pubkey" ) ) ) {
181+
return -1;
182+
} else if( strcmp( "fd_vote_instruction", type_meta->name ) == 0 && size >= sizeof(uint) ) {
183+
uint discriminant = *(uint *)data;
184+
if (discriminant == 14 || discriminant == 15) {
185+
return -1;
186+
}
187+
} else if( strcmp( "fd_gossip_msg", type_meta->name ) == 0 && size >= sizeof(uint)) {
188+
uint discriminant = *(uint *)data;
189+
if (discriminant == 0 || discriminant == 1 || discriminant == 2) {
190+
return -1;
191+
}
192+
}
193+
194+
if( is_blacklisted( type_meta->name ) ) {
181195
return -1;
182196
}
183197

0 commit comments

Comments
 (0)