Presumably this assertion ought to be done before the encoder pointer is dereferenced?
https://github.com/xiph/flac/blob/1507800de4b70e21be71f38caa0d9079d0bc6e45/src/libFLAC/metadata_iterators.c#L671C2-L671C30
Similarly in FLAC__stream_encoder_process_interleaved.