Mercurial > vim
comparison src/hardcopy.c @ 14077:873542706b0b v8.1.0056
patch 8.1.0056: crash when using :hardcopy with illegal byte
commit https://github.com/vim/vim/commit/43dee181f596c81b99e200b6cdfeb02ecfed42c8
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Jun 16 14:44:11 2018 +0200
patch 8.1.0056: crash when using :hardcopy with illegal byte
Problem: Crash when using :hardcopy with illegal byte.
Solution: Check for string_convert() returning NULL. (Dominique Pelle)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Jun 2018 14:45:05 +0200 |
parents | 6acb9148d83e |
children | 2ad722003b36 |
comparison
equal
deleted
inserted
replaced
14076:c3ec29c00689 | 14077:873542706b0b |
---|---|
3370 prt_half_width = FALSE; | 3370 prt_half_width = FALSE; |
3371 #endif | 3371 #endif |
3372 } | 3372 } |
3373 | 3373 |
3374 int | 3374 int |
3375 mch_print_text_out(char_u *p, int len UNUSED) | 3375 mch_print_text_out(char_u *textp, int len UNUSED) |
3376 { | 3376 { |
3377 char_u *p = textp; | |
3377 int need_break; | 3378 int need_break; |
3378 char_u ch; | 3379 char_u ch; |
3379 char_u ch_buff[8]; | 3380 char_u ch_buff[8]; |
3380 float char_width; | 3381 float char_width; |
3381 float next_pos; | 3382 float next_pos; |
3506 prt_attribute_change = FALSE; | 3507 prt_attribute_change = FALSE; |
3507 } | 3508 } |
3508 | 3509 |
3509 #ifdef FEAT_MBYTE | 3510 #ifdef FEAT_MBYTE |
3510 if (prt_do_conv) | 3511 if (prt_do_conv) |
3512 { | |
3511 /* Convert from multi-byte to 8-bit encoding */ | 3513 /* Convert from multi-byte to 8-bit encoding */ |
3512 tofree = p = string_convert(&prt_conv, p, &len); | 3514 tofree = p = string_convert(&prt_conv, p, &len); |
3515 if (p == NULL) | |
3516 { | |
3517 p = (char_u *)""; | |
3518 len = 0; | |
3519 } | |
3520 } | |
3513 | 3521 |
3514 if (prt_out_mbyte) | 3522 if (prt_out_mbyte) |
3515 { | 3523 { |
3516 /* Multi-byte character strings are represented more efficiently as hex | 3524 /* Multi-byte character strings are represented more efficiently as hex |
3517 * strings when outputting clean 8 bit PS. | 3525 * strings when outputting clean 8 bit PS. |