Improve fuzzer_encoder_v2 coverage: add picture and unkown metadata

This commit is contained in:
Martijn van Beurden 2022-11-11 21:36:32 +01:00 committed by GitHub
parent a7b22e9edb
commit 1d3d5d98b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -252,6 +252,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
}
}
}
if(encoder_valid && (metadata_mask & 64)){
if((metadata[num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_PICTURE)) != NULL) {
num_metadata++;
}
}
if(encoder_valid && (metadata_mask & 128)){
if((metadata[num_metadata] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_UNDEFINED)) != NULL) {
metadata[num_metadata]->length = 24;
metadata[num_metadata]->data.unknown.data = (FLAC__byte *)calloc(24, 1);
num_metadata++;
}
}
if(num_metadata && encoder_valid)
encoder_valid = FLAC__stream_encoder_set_metadata(encoder, metadata, num_metadata);