mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-27 19:24:06 +00:00
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.
This commit is contained in:
parent
8c4a3473a8
commit
07b5fb9caf
|
@ -764,9 +764,13 @@ 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 &&
|
||||
cfg->gop_len > 0 &&
|
||||
state->previous_encoder_state != state)
|
||||
|
||||
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)
|
||||
{
|
||||
// For LP-gop, depend on the state of the first reference.
|
||||
int ref_neg = cfg->gop[(state->frame->poc - 1) % cfg->gop_len].ref_neg[0];
|
||||
|
|
Loading…
Reference in a new issue