Skip to content

Commit 2cfc884

Browse files
committed
JavaScript: (potential bugfix) guard from closing the same iconv twice
This is an alternative way to fix #4227. However, this is not an essential way. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
1 parent c59d3f1 commit 2cfc884

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

parsers/jscript.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3811,8 +3811,16 @@ extern void javaScriptSkipObjectExpression (void)
38113811
deleteToken (token);
38123812

38133813
#ifdef HAVE_ICONV
3814-
if (JSUnicodeConverter != (iconv_t) -2 && /* not created */
3815-
JSUnicodeConverter != (iconv_t) -1 /* creation failed */)
3814+
if (
3815+
/* not created */
3816+
JSUnicodeConverter != (iconv_t) -2 &&
3817+
/* creation failed */
3818+
JSUnicodeConverter != (iconv_t) -1 &&
3819+
/* The convert was created before entering this function
3820+
* and no new converter is created in this function (and
3821+
* functions called from this functions). */
3822+
JSUnicodeConverter != originalJSUnicodeConverter
3823+
)
38163824
iconv_close (JSUnicodeConverter);
38173825

38183826
JSUnicodeConverter = originalJSUnicodeConverter;

0 commit comments

Comments
 (0)