• Andreas Rheinhardt's avatar
    avcodec/motion_est_template: Avoid using last + 1 element of array · 7c5d256c
    Andreas Rheinhardt authored
    For an int array[8][2] using &array[8][0] (which is an int*
    pointing to the element beyond the last element of array)
    triggers a "runtime error: index 8 out of bounds for type 'int[8][2]'"
    from (Clang-)UBSan in the fate-vsynth(1|2|_lena)-snow tests.
    
    I don't know whether this is really undefined behaviour or does not
    actually fall under the "pointer arithmetic with the element beyond
    the last element of the array is allowed as long as it is not
    accessed" exception". All I know is that the code itself does not
    read from beyond the last element of the array.
    
    Nevertheless rewrite the code to a form that UBSan does not complain
    about.
    Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
    7c5d256c
motion_est_template.c 37.6 KB