Hello

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
-----------------------------------------------------------
Naofumi Honda

-- 
-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui