Skip to content
  • David Barker's avatar
    Avoid reading uninitialized data in decodemv.c · 0d7c4b05
    David Barker authored
    The existing code has a case where we set a variable to equal
    xd->ref_mv_stack[mbmi->ref_frame[0]][1 + mbmi->ref_mv_idx]
    even for compound blocks. However, the range of allowable
    values for mbmi->ref_mv_idx is determined by the ref_mv_count
    for the *combined* ref frame, not for the first single ref frame.
    
    This means that, if we have more ref-mv candidates for the combined
    ref frame than for the first single ref frame, then we can sometimes
    fetch uninitialized data.
    In every case where this happens, we immediately overwrite
    the destination with the correct mv, but it is still preferable
    to avoid reading uninitialized data.
    
    This patch moves the code block to avoid this bug. In addition,
    the variable (nearmv[0]) is only used when the mode equals NEARMV,
    so the condition on its assignment is changed to reflect that.
    
    Change-Id: I3bd268dc80d8065d5189999232b8a0f826d40a95
    0d7c4b05