Re: rdesktion started segmentation faulting shortly after logon.

Nico Baggus <[email protected]>
Newsgroups gmane.network.rdesktop.user
Message-ID <[email protected]>

Followup 2
(gdb) bt
#0  0xb7df97ff in XPutImage () from /usr/lib/libX11.so.6
#1  0x08050217 in ui_desktop_restore ()
#2  0x0805e36c in process_orders ()
#3  0x08061f7b in rdp5_process ()
#4  0x0805b877 in rdp_recv ()
#5  0x0805bd67 in rdp_loop ()
#6  0x0805c871 in rdp_main_loop ()
#7  0x0804d875 in main ()
(gdb) info registers
eax            0x1a1    417
ecx            0x10     16
edx            0x0      0
ebx            0xb7e9db24       -1209410780
esp            0xbff75ca0       0xbff75ca0
ebp            0xbff75d38       0xbff75d38
esi            0x1a1    417
edi            0x0      0
eip            0xb7df97ff       0xb7df97ff <XPutImage+83>
eflags         0x210246 [ PF ZF IF RF ID ]
cs             0x73     115
ss             0x7b     123
ds             0x7b     123
es             0x7b     123
fs             0x0      0
gs             0x33     51

Disassemble of Xput up to crash....
Dump of assembler code for function XPutImage:
0xb7df97ac <XPutImage+0>:       push   %ebp
0xb7df97ad <XPutImage+1>:       mov    %esp,%ebp
0xb7df97af <XPutImage+3>:       push   %edi
0xb7df97b0 <XPutImage+4>:       push   %esi
0xb7df97b1 <XPutImage+5>:       push   %ebx
0xb7df97b2 <XPutImage+6>:       call   0xb7de3de7 <_fini+1329523>
0xb7df97b7 <XPutImage+11>:      add    $0xa436d,%ebx
0xb7df97bd <XPutImage+17>:      sub    $0x8c,%esp
0xb7df97c3 <XPutImage+23>:      cmpl   $0x0,0x18(%ebp)
0xb7df97c7 <XPutImage+27>:      mov    0x28(%ebp),%eax
0xb7df97ca <XPutImage+30>:      mov    0x2c(%ebp),%edx
0xb7df97cd <XPutImage+33>:      mov    0x1c(%ebp),%edi
0xb7df97d0 <XPutImage+36>:      mov    %eax,0xffffff78(%ebp)
0xb7df97d6 <XPutImage+42>:      mov    %edx,0xffffff7c(%ebp)
0xb7df97dc <XPutImage+48>:      jns    0xb7df97f0 <XPutImage+68>
0xb7df97de <XPutImage+50>:      mov    0x18(%ebp),%ecx
0xb7df97e1 <XPutImage+53>:      movl   $0x0,0x18(%ebp)
0xb7df97e8 <XPutImage+60>:      add    %ecx,%eax
0xb7df97ea <XPutImage+62>:      mov    %eax,0xffffff78(%ebp)
0xb7df97f0 <XPutImage+68>:      test   %edi,%edi
0xb7df97f2 <XPutImage+70>:      jns    0xb7df97fc <XPutImage+80>
0xb7df97f4 <XPutImage+72>:      add    %edi,0xffffff7c(%ebp)
0xb7df97fa <XPutImage+78>:      xor    %edi,%edi
0xb7df97fc <XPutImage+80>:      mov    0x14(%ebp),%edx
0xb7df97ff <XPutImage+83>:      mov    (%edx),%eax               <---- Parm#4
0xb7df9801 <XPutImage+85>:      mov    0x18(%ebp),%edx
0xb7df9804 <XPutImage+88>:      add    0xffffff78(%ebp),%edx
0xb7df980a <XPutImage+94>:      mov    %eax,%ecx
0xb7df980c <XPutImage+96>:      sub    0x18(%ebp),%ecx

Caller of XputImage
0x080501b5 <ui_desktop_restore+68>:     mov    %eax,0xffffffd8(%ebp)
0x080501b8 <ui_desktop_restore+71>:     idiv   %ebx
0x080501ba <ui_desktop_restore+73>:     push   %eax
0x080501bb <ui_desktop_restore+74>:     mov    0x81ab9e0,%eax
0x080501c0 <ui_desktop_restore+79>:     pushl  0x38(%eax)
0x080501c3 <ui_desktop_restore+82>:     pushl  0x18(%ebp)
0x080501c6 <ui_desktop_restore+85>:     push   %esi
0x080501c7 <ui_desktop_restore+86>:     push   %ecx
0x080501c8 <ui_desktop_restore+87>:     push   $0x0
0x080501ca <ui_desktop_restore+89>:     push   $0x2
0x080501cc <ui_desktop_restore+91>:     pushl  0x806d058
0x080501d2 <ui_desktop_restore+97>:     pushl  0x806d054
0x080501d8 <ui_desktop_restore+103>:    push   %eax
0x080501d9 <ui_desktop_restore+104>:    call   0x804b0dc <XCreateImage@plt>
0x080501de <ui_desktop_restore+109>:    add    $0x30,%esp
0x080501e1 <ui_desktop_restore+112>:    cmpl   $0x0,0x806cd84
0x080501e8 <ui_desktop_restore+119>:    mov    %eax,0xffffffe0(%ebp)
0x080501eb <ui_desktop_restore+122>:    je     0x80502e6 
<ui_desktop_restore+373>
0x080501f1 <ui_desktop_restore+128>:    push   %edx
0x080501f2 <ui_desktop_restore+129>:    push   %edx
0x080501f3 <ui_desktop_restore+130>:    pushl  0x18(%ebp)
0x080501f6 <ui_desktop_restore+133>:    push   %esi
0x080501f7 <ui_desktop_restore+134>:    push   %edi
0x080501f8 <ui_desktop_restore+135>:    pushl  0xc(%ebp)
0x080501fb <ui_desktop_restore+138>:    push   $0x0
0x080501fd <ui_desktop_restore+140>:    push   $0x0
0x080501ff <ui_desktop_restore+142>:    push   %eax
0x08050200 <ui_desktop_restore+143>:    pushl  0x806d00c
0x08050206 <ui_desktop_restore+149>:    pushl  0x806d010
0x0805020c <ui_desktop_restore+155>:    pushl  0x81ab9e0
0x08050212 <ui_desktop_restore+161>:    call   0x804bb8c <XPutImage@plt>
0x08050217 <ui_desktop_restore+166>:    add    $0x28,%esp     ^^^ ------- here
0x0805021a <ui_desktop_restore+169>:    push   %edi
0x0805021b <ui_desktop_restore+170>:    pushl  0xc(%ebp)
0x0805021e <ui_desktop_restore+173>:    pushl  0x18(%ebp)
0x08050221 <ui_desktop_restore+176>:    push   %esi
0x08050222 <ui_desktop_restore+177>:    push   %edi
0x08050223 <ui_desktop_restore+178>:    pushl  0xc(%ebp)
0x08050226 <ui_desktop_restore+181>:    pushl  0x806d00c
0x0805022c <ui_desktop_restore+187>:    pushl  0x81ab9ec
0x08050232 <ui_desktop_restore+193>:    pushl  0x806d010
0x08050238 <ui_desktop_restore+199>:    pushl  0x81ab9e0
0x0805023e <ui_desktop_restore+205>:    call   0x804b1ec <XCopyArea@plt>
0x08050243 <ui_desktop_restore+210>:    mov    0x806d008,%ebx
0x08050249 <ui_desktop_restore+216>:    add    $0x30,%esp
0x0805024c <ui_desktop_restore+219>:    test   %ebx,%ebx
0x0805024e <ui_desktop_restore+221>:    je     0x80503ce 
<ui_desktop_restore+605>


>From this I conclude that XputImages crashes because the image variable is 
NULL. (See following code fragment from xwin.c...)
Appearantly XCreateImage failes (No errors checked) ....
and the fail result crashes rdesktop.
The only question is why did it work a few months ago and doesn't it now.
With no appearant changes.

void
ui_desktop_restore(uint32 offset, int x, int y, int cx, int cy)
{
        XImage *image;
        uint8 *data;

        offset *= g_bpp / 8;
        data = cache_get_desktop(offset, cx, cy, g_bpp / 8);
        if (data == NULL)
                return;

        image = XCreateImage(g_display, g_visual, g_depth, ZPixmap, 0,
                             (char *) data, cx, cy, BitmapPad(g_display), cx * 
g_bpp / 8);

        if (g_ownbackstore)
        {
                XPutImage(g_display, g_backstore, g_gc, image, 0, 0, x, y, cx, 
cy);
                XCopyArea(g_display, g_backstore, g_wnd, g_gc, x, y, cx, cy, 
x, y);
                ON_ALL_SEAMLESS_WINDOWS(XCopyArea,
                                        (g_display, g_backstore, sw->wnd, 
g_gc,
                                         x, y, cx, cy, x - sw->xoffset, y - 
sw->yoffset));
        }
        else
        {
                XPutImage(g_display, g_wnd, g_gc, image, 0, 0, x, y, cx, cy);
                ON_ALL_SEAMLESS_WINDOWS(XCopyArea,
                                        (g_display, g_wnd, sw->wnd, g_gc, x, 
y, cx, cy,
                                         x - sw->xoffset, y - sw->yoffset));
        }

        XFree(image);
}

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.