diff options
author | yang <yang.y.wang@intel.com> | 2012-07-24 00:51:10 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-07-24 00:55:05 +0200 |
commit | 6a2bad2c4f609c2a35672c2e5b9775b0865b4c3a (patch) | |
tree | c10a702318d02245f1a70273189fc5af6c120070 /libavcodec/jrevdct.c | |
parent | dc31b84cbfb73b31211afaacfb8d340c14282a2e (diff) | |
download | ffmpeg-6a2bad2c4f609c2a35672c2e5b9775b0865b4c3a.tar.gz |
dsputil_mmx: fix incorrect assembly code
In file libavcodec/x86/dsputil_mmx.c, function 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" etc have problem.
For 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 the 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 the ffmpeg using Intel C++ Compiler, IPO+PGO optimization. The ffmpeg was crashed when decoding a mjpeg video.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/jrevdct.c')
0 files changed, 0 insertions, 0 deletions