Ticket #3116: fix-various-segfaults-fixed-in-fedora.patch

File fix-various-segfaults-fixed-in-fedora.patch, 2.8 KB (added by eugenesan, 9 years ago)

fix various segfauls fixed in fedora

  • lib/vfs/direntry.c

    From 473484f759dce2e82dad43f948f4dd0d1b16968e Mon Sep 17 00:00:00 2001
    From: "Eugene San (eugenesan)" <eugenesan@gmail.com>
    Date: Tue, 3 Dec 2013 10:09:28 +0200
    Subject: [PATCH] fix various segfaults fixed in fedora
    
    * attempt to fix segfault while passing messages to widgets (#907045, #912033)
    * fix possible segfault when freeing a VFS (#923415)
    * fix segfault in cpio VFS while reading corrupted RPM (#921414)
    * fix segfault in mcedit when pressing alt-minus
    ---
     lib/vfs/direntry.c         | 2 ++
     lib/widget/widget-common.h | 2 +-
     src/editor/editcmd.c       | 2 +-
     src/vfs/cpio/cpio.c        | 2 +-
     4 files changed, 5 insertions(+), 3 deletions(-)
    
    diff --git a/lib/vfs/direntry.c b/lib/vfs/direntry.c
    index 64a8230..3f2384c 100644
    a b vfs_s_close (void *fh) 
    656656    int res = 0; 
    657657    struct vfs_class *me = FH_SUPER->me; 
    658658 
     659    if (!me) return -1; 
     660 
    659661    FH_SUPER->fd_usage--; 
    660662    if (!FH_SUPER->fd_usage) 
    661663        vfs_stamp_create (me, FH_SUPER); 
  • lib/widget/widget-common.h

    diff --git a/lib/widget/widget-common.h b/lib/widget/widget-common.h
    index 93a2d9a..db6e830 100644
    a b gboolean mouse_global_in_widget (const Gpm_Event * event, const Widget * w); 
    159159static inline cb_ret_t 
    160160send_message (void *w, void *sender, widget_msg_t msg, int parm, void *data) 
    161161{ 
    162     return WIDGET (w)->callback (WIDGET (w), WIDGET (sender), msg, parm, data); 
     162    return w ? WIDGET (w)->callback (WIDGET (w), WIDGET (sender), msg, parm, data) : 1; 
    163163} 
    164164 
    165165/* --------------------------------------------------------------------------------------------- */ 
  • src/editor/editcmd.c

    diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
    index b726b85..e976def 100644
    a b edit_load_back_cmd (WEdit * edit) 
    34153415        return FALSE; 
    34163416 
    34173417    edit_stack_iterator--; 
    3418     if (edit_history_moveto[edit_stack_iterator].filename_vpath != NULL) 
     3418    if (edit_stack_iterator >= 0 && edit_history_moveto[edit_stack_iterator].filename_vpath != NULL) 
    34193419        return edit_reload_line (edit, edit_history_moveto[edit_stack_iterator].filename_vpath, 
    34203420                                 edit_history_moveto[edit_stack_iterator].line); 
    34213421 
  • src/vfs/cpio/cpio.c

    diff --git a/src/vfs/cpio/cpio.c b/src/vfs/cpio/cpio.c
    index 437c887..a0ec51b 100644
    a b cpio_super_same (const vfs_path_element_t * vpath_element, struct vfs_s_super *p 
    788788        return 0; 
    789789 
    790790    /* Has the cached archive been changed on the disk? */ 
    791     if (((cpio_super_data_t *) parc->data)->st.st_mtime < archive_stat->st_mtime) 
     791    if (parc->data && ((cpio_super_data_t *) parc->data)->st.st_mtime < archive_stat->st_mtime) 
    792792    { 
    793793        /* Yes, reload! */ 
    794794        (*vfs_cpiofs_ops.free) ((vfsid) parc);