• Yang Wang's avatar
    dsputil_mmx: fix incorrect assembly code · 845e92fd
    Yang Wang authored
    In ff_put_pixels_clamped_mmx(), there are two assembly code blocks.
    In the first block (in the unrolled loop), the instructions
    "movq 8%3, %%mm1 \n\t", and so forth, have problems.
    
    From above instruction, it is clear what the programmer wants: a load from
    p + 8. But this assembly code doesn’t guarantee that. It only works if the
    compiler puts p in a register to produce an instruction like this:
    "movq 8(%edi), %mm1". During compiler optimization, it is possible that the
    compiler will be able to constant propagate into p. Suppose p = &x[10000].
    Then operand 3 can become 10000(%edi), where %edi holds &x. And the instruction
    becomes "movq 810000(%edx)". That is, it will stride by 810000 instead of 8.
    
    This will cause a segmentation fault.
    
    This error was fixed in the second block of the assembly code, but not in
    the unrolled loop.
    
    How to reproduce:
        This error is exposed when we build using Intel C++ Compiler, with
        IPO+PGO optimization enabled. Crashed when decoding an MJPEG video.
    Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
    Signed-off-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
    845e92fd
Name
Last commit
Last update
compat Loading commit data...
doc Loading commit data...
libavcodec Loading commit data...
libavdevice Loading commit data...
libavfilter Loading commit data...
libavformat Loading commit data...
libavresample Loading commit data...
libavutil Loading commit data...
libswscale Loading commit data...
presets Loading commit data...
tests Loading commit data...
tools Loading commit data...
.gitignore Loading commit data...
COPYING.GPLv2 Loading commit data...
COPYING.GPLv3 Loading commit data...
COPYING.LGPLv2.1 Loading commit data...
COPYING.LGPLv3 Loading commit data...
CREDITS Loading commit data...
Changelog Loading commit data...
Doxyfile Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README Loading commit data...
RELEASE Loading commit data...
arch.mak Loading commit data...
avconv.c Loading commit data...
avplay.c Loading commit data...
avprobe.c Loading commit data...
avserver.c Loading commit data...
cmdutils.c Loading commit data...
cmdutils.h Loading commit data...
cmdutils_common_opts.h Loading commit data...
common.mak Loading commit data...
configure Loading commit data...
library.mak Loading commit data...
version.sh Loading commit data...