Skip to content

Commit f97ddbe

Browse files
committed
patch 7.4.1439
Problem: Using uninitialzed variable. Solution: Initialize vc_type.
1 parent c7f0ebc commit f97ddbe

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/json.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,15 @@ write_string(garray_T *gap, char_u *str)
8383
vimconv_T conv;
8484
char_u *converted = NULL;
8585

86-
convert_setup(&conv, p_enc, (char_u*)"utf-8");
87-
if (conv.vc_type != CONV_NONE)
88-
converted = res = string_convert(&conv, res, NULL);
89-
convert_setup(&conv, NULL, NULL);
86+
if (!enc_utf8)
87+
{
88+
conv.vc_type = CONV_NONE;
89+
convert_setup(&conv, p_enc, (char_u*)"utf-8");
90+
if (conv.vc_type != CONV_NONE)
91+
converted = res = string_convert(&conv, res, NULL);
92+
convert_setup(&conv, NULL, NULL);
93+
}
9094
#endif
91-
9295
ga_append(gap, '"');
9396
while (*res != NUL)
9497
{
@@ -540,10 +543,14 @@ json_decode_string(js_read_T *reader, typval_T *res)
540543

541544
p = reader->js_buf + reader->js_used + 1; /* skip over " */
542545
#if defined(FEAT_MBYTE) && defined(USE_ICONV)
543-
convert_setup(&conv, (char_u*)"utf-8", p_enc);
544-
if (conv.vc_type != CONV_NONE)
545-
converted = p = string_convert(&conv, p, NULL);
546-
convert_setup(&conv, NULL, NULL);
546+
if (!enc_utf8)
547+
{
548+
conv.vc_type = CONV_NONE;
549+
convert_setup(&conv, (char_u*)"utf-8", p_enc);
550+
if (conv.vc_type != CONV_NONE)
551+
converted = p = string_convert(&conv, p, NULL);
552+
convert_setup(&conv, NULL, NULL);
553+
}
547554
#endif
548555
while (*p != '"')
549556
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,8 @@ static char *(features[]) =
743743

744744
static int included_patches[] =
745745
{ /* Add new patch number below this line */
746+
/**/
747+
1439,
746748
/**/
747749
1438,
748750
/**/

0 commit comments

Comments
 (0)