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 Dec 17, 2024
1 parent 907df21 commit 1abf77b
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 @@ -360,7 +360,7 @@ size_t IconvWrapper::Convert(std::string_view source, std::span<char> dest) {
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 1abf77b

Please sign in to comment.