Fix out-of-bounds read in encoderstate
When calling encoder_state_encode_leaf with POC 0, index -1 of the GOP
array would be accessed. Fixed by skipping the code for I-frames.
@@ -764,7 +764,11 @@ static void encoder_state_encode_leaf(encoder_state_t * const state)
// Select which frame dependancies should be set to.
const encoder_state_t * ref_state = NULL;
- if (cfg->gop_lowdelay &&
+
+ if (state->frame->slicetype == KVZ_SLICE_I) {
+ // I-frames have no references.
+ ref_state = NULL;
+ } else if (cfg->gop_lowdelay &&
cfg->gop_len > 0 &&
state->previous_encoder_state != state)
{
