Skip to content

Commit

Permalink
libaegisub: Avoid calling iconv_close(iconv_invalid)
Browse files Browse the repository at this point in the history
IsConversionSupported unconditionally calls iconv_close on the
descriptor returned by iconv_open. This may result in crashes if
iconv_open returns iconv_invalid.
  • Loading branch information
al3xtjames authored and arch1t3cht committed Sep 7, 2023
1 parent 47c923d commit 4f67db8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libaegisub/common/charset_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ size_t IconvWrapper::DstStrLen(const char* str) {
bool IsConversionSupported(const char *src, const char *dst) {
iconv_t cd = iconv_open(dst, src);
bool supported = cd != iconv_invalid;
iconv_close(cd);
if (supported) iconv_close(cd);
return supported;
}

Expand Down

0 comments on commit 4f67db8

Please sign in to comment.