Naofumi Honda wrote: > Recently I had experienced a segmentation fault > at the last mch_memmove() call in the function > clip_x11_convert_selection_cb() of ui.c. > > This fault happens under the conditions: > *target == utf8_atom > *length == 0 > enc_utf8 == false. > > In fact, if clip_x11_convert_selection_cb() is called > under these conditions from GetConversion() in libXt, > then the program reaches the last mch_memmove() in the function > with the size argument being (size_t)(- 1), and crashes. > > The following patch prevents from this. > > ----------------------------------------------------------- > *** src/ui.c.org 2014-05-29 23:19:09.000000000 +0900 > --- src/ui.c 2014-05-29 23:23:37.000000000 +0900 > *************** > *** 2324,2330 **** > if ( *target != XA_STRING > #ifdef FEAT_MBYTE > && *target != vimenc_atom > ! && *target != utf8_atom > #endif > && *target != vim_atom > && *target != text_atom > --- 2324,2330 ---- > if ( *target != XA_STRING > #ifdef FEAT_MBYTE > && *target != vimenc_atom > ! && (*target != utf8_atom || !enc_utf8) > #endif > && *target != vim_atom > && *target != text_atom > -----------------------------------------------------------
Thanks! Although I would expect a check for the length, not for the encoding. Or perhaps when conversion to utf8 is not possible. -- hundred-and-one symptoms of being an internet addict: 237. You tattoo your email address on your forehead. /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.