[MPlayer-dev-eng] Segfault caused by the "expand" filter

Zuxy Meng zuxy.meng at gmail.com
Sun Mar 20 13:27:02 CET 2011


2011/3/19 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
> On Sat, Mar 19, 2011 at 10:30:14PM +0800, Zuxy Meng wrote:
>> 2011/3/17 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
>> > On Wed, Mar 16, 2011 at 06:19:04PM +0800, Zuxy Meng wrote:
>> >> 2011/3/16 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
>> >> > On 15 Mar 2011, at 03:57, Zuxy Meng <zuxy.meng at gmail.com> wrote:
>> >> >> Hope here's still atmosphere for technical discussions:
>> >> >>
>> >> >> I met segfaults triggered by unaligned accesses of SSE instructions.
>> >> >> The root cause is within the get_image() function of the "expand"
>> >> >> filter, in lines like:
>> >> >>
>> >> >>    if(mpi->flags&MP_IMGFLAG_PLANAR){
>> >> >>        mpi->planes[0]=vf->dmpi->planes[0]+
>> >> >>        vf->priv->exp_y*vf->dmpi->stride[0]+vf->priv->exp_x;
>> >> >>
>> >> >> Here vf->dmpi->planes[0] is 16-byte aligned, but mpi->planes[0] may not be.
>> >> >>
>> >> >> I'm not sure what's the correct fix here. Would a simple forced align
>> >> >> before the assignment work (e.g. ((vf->dmpi->planes[0] + ...)&~15))?
>> >> >
>> >> > To solve it properly you have to allocate a new image and memcpy instead of using EXPORT image type (or is this the DR path? Disable DR in that case).
>> >>
>> >> Yes I guess it's the DR path.
>> >>
>> >> > Alternatively filters requiring the alignment could do the memcpy, but I think that's more effort for little gain.
>> >>
>> >> The problem happens when expand isn't the last filter, e.g. vf=expand...,pp=ac
>> >
>> > That doesn't make sense, the line you quoted only causes the filters (and decoder)
>> > _before_ to get unaligned pointers.
>>
>> I'm puzzled too. But in my case vf=pp=ac,expand=::::1:8/5 works and
>> vf=expand=::::1:8/5,pp=ac crashes.
>
> That doesn't say anything at all about where and why the crash happens.
> Probably the pp filter allocates a new frame to pass to the decoder whereas
> it itself doesn't need the pointers to be aligned

This is the log and traceback, from which you can see the problematic
address 0x181c705 was allocated by the expand filter.

gdb --args mplayer -msglevel decvideo=7 value.asf
GNU gdb (GDB) Fedora (7.2-46.fc14)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/bin/mplayer...done.
(gdb) r
Starting program: /usr/local/bin/mplayer -msglevel decvideo=7 value.asf
[Thread debugging using libthread_db enabled]
Missing separate debuginfo for /usr/lib64/catalyst/libatiuki.so.1
MPlayer SVN-r33084-4.5.1 (C) 2000-2011 MPlayer Team

Playing value.asf.
ASF file format detected.
[asfheader] Audio stream found, -aid 1
[asfheader] Video stream found, -vid 2
VIDEO:  [WMV1]  240x176  24bpp  1000.000 fps    0.0 kbps ( 0.0 kbyte/s)
Clip info:
 title:
 author:
 copyright:
 comments:
Load subtitles in ./
Opening video filter: [pp=ac]
Opening video filter: [expand osd=1 aspect=8/5]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 1.600000, round: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec.size: 0 x 0
INFO: libavcodec init OK!
Selected video codec: [ffwmv1] vfm: ffmpeg (FFmpeg WMV1/WMV7)
==========================================================================
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 11025 Hz, 1 ch, s16le, 8.1 kbit/4.59% (ratio: 1013->22050)
Selected audio codec: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
[New Thread 0x7fffecada700 (LWP 5108)]
AO: [pulse] 11025Hz 1ch s16le (2 bytes per sample)
Starting playback...
vd_ffmpeg data: 8a847709, fb3c30e0, e913872a, 3f58c5b7
[ffmpeg] aspect_ratio: 0.000000
VDec: vo config request - 240 x 176 (preferred colorspace: Planar YV12)
[PP] Using external postprocessing filter, max q = 6.
Trying filter chain: expand pp vo
Movie-Aspect is undefined - no prescaling applied.
VO: [xv] 282x176 => 282x176 Planar YV12
using IP
*** [pp] Allocating mp_image_t, 288x176x12bpp YUV planar, 76032 bytes
(imgfmt: 32315659, planes: 0x16d7f70,0x16e76f0,0x16e4570 strides:
288,144,144, chroma: 144x88, shift: h:1,v:1)
*** [expand] Direct Rendering mp_image_t, 288x176x12bpp YUV planar, 76032 bytes
(imgfmt: 32315659, planes: 0x16d7f85,0x16e76fa,0x16e457a strides:
288,144,144, chroma: 120x88, shift: h:1,v:1)
*** [vo] Allocating mp_image_t, 288x176x12bpp YUV planar, 76032 bytes
(imgfmt: 32315659, planes: 0x1809a80,0x1819200,0x1816080 strides:
288,144,144, chroma: 144x88, shift: h:1,v:1)
Detaching after fork from child process 5112.
vd_ffmpeg data: 42de6749, 13a2530e, f9950ac3, 1fd1589a
using IP
*** [pp] Allocating mp_image_t, 288x176x12bpp YUV planar, 76032 bytes
(imgfmt: 32315659, planes: 0x181c6f0,0x182be70,0x1828cf0 strides:
288,144,144, chroma: 144x88, shift: h:1,v:1)
*** [expand] Direct Rendering mp_image_t, 288x176x12bpp YUV planar, 76032 bytes
(imgfmt: 32315659, planes: 0x181c705,0x182be7a,0x1828cfa strides:
288,144,144, chroma: 120x88, shift: h:1,v:1)

Program received signal SIGSEGV, Segmentation fault.
0x00000000008b90aa in put_pixels16_sse2 (block=0x181c705 "", pixels=
    0x16d7f85 "\300\277\277\276\275\274\273\272\277\312\323Ħ\231\244\260\266\267\270\271\271\270\267\266\267\273\274\267\262\266\305\323\320\315\314\315\321\325\326\326\322\323\325\327\326\323\320\316\317\317\320\321\322\322\323\323\323\322\321\321\322\325\330\332\322\325\327\326\323\322\325\327\331\325\323\323\320ƽ\271\277\301\304\307\310\307\305\303ÿ\273\275\310\322\321\313\324\334\323\325\336\333\325ʽ\276\301\306\310\306\302\300\277\277\276\274\273\273\272\272\264\277\313\316\310\300\273\271\301\301\302\300\272\267\270\272\273\310\321\326\327\321\314\316\330\330\327\325\323\324\327\333\334\332\327\324\323\322\322\322\327\325\322\320\320\322\325\327\330\331\333\334\334\333\331\330\326\332\335\332\323\315\312ʾ\277\276\274\271\272\275\300\313\316\322\325\327\327\326",
<incomplete sequence \325>..., line_size=288, h=16) at
x86/dsputil_mmx.c:452
452	    __asm__ volatile(
Missing separate debuginfos, use: debuginfo-install
atk-1.32.0-1.fc14.x86_64 cairo-1.10.2-1.fc14.x86_64
dbus-libs-1.4.0-2.fc14.x86_64 enca-1.13-1.fc14.x86_64
expat-2.0.1-10.fc13.x86_64 faac-1.28-2.fc12.x86_64
flac-1.2.1-6.fc12.x86_64 fontconfig-2.8.0-2.fc14.x86_64
freetype-freeworld-2.4.2-3.fc14.x86_64
gdk-pixbuf2-2.22.0-1.fc14.x86_64 glib2-2.26.0-2.fc14.x86_64
glibc-2.13-1.x86_64 gtk2-2.22.0-1.fc14.1.x86_64
libICE-1.0.6-2.fc13.x86_64 libSM-1.1.0-7.fc12.x86_64
libX11-1.3.4-3.fc14.x86_64 libXau-1.0.6-1.fc14.x86_64
libXcomposite-0.4.2-1.fc14.x86_64 libXcursor-1.1.10-5.fc14.x86_64
libXdamage-1.1.3-1.fc14.x86_64 libXext-1.1.2-2.fc14.x86_64
libXfixes-4.0.5-1.fc14.x86_64 libXi-1.3.2-1.fc14.x86_64
libXinerama-1.1-2.fc13.x86_64 libXrandr-1.3.0-5.fc13.x86_64
libXrender-0.9.6-1.fc14.x86_64 libXtst-1.0.99.2-3.fc12.x86_64
libXv-1.0.5-1.fc13.x86_64 libXvMC-1.0.5-1.fc13.x86_64
libXxf86vm-1.1.0-1.fc13.x86_64 libasyncns-0.8-1.fc13.x86_64
libgcc-4.5.1-4.fc14.x86_64 libmp4v2-1.5.0.1-10.fc12.x86_64
libogg-1.2.0-1.fc14.x86_64 libpng-1.2.44-1.fc14.x86_64
libselinux-2.0.96-6.fc14.1.x86_64 libsndfile-1.0.23-1.fc14.x86_64
libstdc++-4.5.1-4.fc14.x86_64 libuuid-2.18-4.8.fc14.x86_64
libvorbis-1.3.1-2.fc14.x86_64 libxcb-1.7-1.fc14.x86_64
pango-1.28.1-5.fc14.x86_64 pixman-0.18.4-1.fc14.x86_64
pulseaudio-libs-0.9.21-7.fc14.x86_64
tcp_wrappers-libs-7.6-59.fc14.x86_64 zlib-1.2.5-2.fc14.x86_64
(gdb) bt
#0  0x00000000008b90aa in put_pixels16_sse2 (block=0x181c705 "", pixels=
    0x16d7f85 "\300\277\277\276\275\274\273\272\277\312\323Ħ\231\244\260\266\267\270\271\271\270\267\266\267\273\274\267\262\266\305\323\320\315\314\315\321\325\326\326\322\323\325\327\326\323\320\316\317\317\320\321\322\322\323\323\323\322\321\321\322\325\330\332\322\325\327\326\323\322\325\327\331\325\323\323\320ƽ\271\277\301\304\307\310\307\305\303ÿ\273\275\310\322\321\313\324\334\323\325\336\333\325ʽ\276\301\306\310\306\302\300\277\277\276\274\273\273\272\272\264\277\313\316\310\300\273\271\301\301\302\300\272\267\270\272\273\310\321\326\327\321\314\316\330\330\327\325\323\324\327\333\334\332\327\324\323\322\322\322\327\325\322\320\320\322\325\327\330\331\333\334\334\333\331\330\326\332\335\332\323\315\312ʾ\277\276\274\271\272\275\300\313\316\322\325\327\327\326",
<incomplete sequence \325>..., line_size=288, h=16) at
x86/dsputil_mmx.c:452
#1  0x00000000007e19a7 in mpeg_motion_internal (s=0x14f0ad0, dest_y=
    0x181c705 "", dest_cb=
    0x182be7a "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\---Type
<return> to continue, or q <return> to quit---
200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"...,
dest_cr=
    0x1828cfa "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"...,
dir=<value optimized out>, ref_picture=0x16e76fa, pix_op=
    0x14f1ff8, qpix_op=0x14f22b8) at mpegvideo_common.h:352
#2  mpeg_motion (s=0x14f0ad0, dest_y=0x181c705 "", dest_cb=
    0x182be7a "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\---Type
<return> to continue, or q <return> to quit---
200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"...,
dest_cr=
    0x1828cfa "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"...,
dir=<value optimized out>, ref_picture=0x16e76fa, pix_op=
    0x14f1ff8, qpix_op=0x14f22b8) at mpegvideo_common.h:380
#3  MPV_motion_internal (s=0x14f0ad0, dest_y=0x181c705 "", dest_cb=
    0x182be7a "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\---Type
<return> to continue, or q <return> to quit---
200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"...,
dest_cr=
    0x1828cfa "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"...,
dir=<value optimized out>, ref_picture=0x16e76fa, pix_op=
    0x14f1ff8, qpix_op=0x14f22b8) at mpegvideo_common.h:734
#4  MPV_motion (s=0x14f0ad0, dest_y=0x181c705 "", dest_cb=
    0x182be7a "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\---Type
<return> to continue, or q <return> to quit---
200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"...,
dest_cr=
    0x1828cfa "\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200\200"...,
dir=<value optimized out>, ref_picture=0x16e76fa, pix_op=
    0x14f1ff8, qpix_op=0x14f22b8) at mpegvideo_common.h:896
#5  0x00000000007e83cc in MPV_decode_mb_internal (s=0x14f0ad0,
    block=<value optimized out>) at mpegvideo.c:1953
#6  MPV_decode_mb (s=0x14f0ad0, block=<value optimized out>)
    at mpegvideo.c:2091
#7  0x000000000074f440 in decode_slice (s=0x14f0ad0) at h263dec.c:252
#8  0x000000000075048a in ff_h263_decode_frame (avctx=0x14f0620, data=
---Type <return> to continue, or q <return> to quit---
    0x14f04c0, data_size=0x7fffffffbeec, avpkt=<value optimized out>)
    at h263dec.c:666
#9  0x00000000008709d0 in avcodec_decode_video2 (avctx=0x14f0620, picture=
    0x14f04c0, got_picture_ptr=0x7fffffffbeec, avpkt=0x7fffffffbe70)
    at utils.c:705
#10 0x00000000005d7451 in decode (sh=0x14dfbb0, data=0x14e0680, len=484,
    flags=<value optimized out>) at libmpcodecs/vd_ffmpeg.c:838
#11 0x000000000050dc84 in decode_video (sh_video=0x14dfbb0, start=
    0x14e0680 "Ig\336B\016S\242\023\303\n\225\371\232X\321\037\232VF4l\205\262\023\377\342\341\260X\363\r\001 at 2\361\017\300j\304`",
<incomplete sequence \321>, in_size=<value optimized out>,
drop_frame=0, pts=<value optimized out>,
    full_frame=0x7fffffffbfec) at libmpcodecs/dec_video.c:392
#12 0x000000000048304c in update_video (blit_frame=0x7fffffffe0c8)
    at mplayer.c:2394
#13 0x0000000000487f90 in main (argc=<value optimized out>,
    argv=<value optimized out>) at mplayer.c:3709



-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6


More information about the MPlayer-dev-eng mailing list