<div dir="ltr">Hey Stephan,<br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 17, 2016 at 9:38 AM, Stephan Bergmann <span dir="ltr"><<a href="mailto:sbergman@redhat.com" target="_blank">sbergman@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 06/15/2016 09:52 PM, Markus Mohrhard wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
commit b5876bfcb69a65c87d602bae687b3c0634c0a1e7<br>
Author: Markus Mohrhard <<a href="mailto:markus.mohrhard@googlemail.com" target="_blank">markus.mohrhard@googlemail.com</a>><br>
Date:   Wed Jun 15 20:15:20 2016 +0200<br>
<br>
    passing a NULL pointer to fileno is not allowed<br>
<br>
    See crash reports at<br>
    <a href="http://crashreport.libreoffice.org/stats/signature/do_msvcr_magic+0x7" rel="noreferrer" target="_blank">http://crashreport.libreoffice.org/stats/signature/do_msvcr_magic+0x7</a><br>
    and documentation at<br>
    <a href="https://msdn.microsoft.com/en-us/library/zs6wbdhx.aspx" rel="noreferrer" target="_blank">https://msdn.microsoft.com/en-us/library/zs6wbdhx.aspx</a><br>
<br>
    Change-Id: Ia9166d3b9fa10b87585821504e39cdfecbd22eda<br>
    Reviewed-on: <a href="https://gerrit.libreoffice.org/26317" rel="noreferrer" target="_blank">https://gerrit.libreoffice.org/26317</a><br>
    Reviewed-by: Michael Stahl <<a href="mailto:mstahl@redhat.com" target="_blank">mstahl@redhat.com</a>><br>
    Tested-by: Markus Mohrhard <<a href="mailto:markus.mohrhard@googlemail.com" target="_blank">markus.mohrhard@googlemail.com</a>><br>
<br>
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx<br>
index fad3c0a9..43ddc82 100644<br>
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx<br>
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx<br>
@@ -548,6 +548,9 @@ static void do_msvcr_magic(rtl_uString *jvm_dll)<br>
<br>
     FILE *f = _wfopen(reinterpret_cast<LPCWSTR>(Module->buffer), L"rb");<br>
<br>
+    if (!f)<br>
+        return;<br>
+<br>
     if (fstat(fileno(f), &st) == -1)<br>
     {<br>
         fclose(f);<br>
</blockquote>
<br>
What I don't quite understand is: <<a href="https://cgit.freedesktop.org/libreoffice/core/commit/?id=a82e532ce006c54b2740de74d1da5d11307da7c1" rel="noreferrer" target="_blank">https://cgit.freedesktop.org/libreoffice/core/commit/?id=a82e532ce006c54b2740de74d1da5d11307da7c1</a>> "fdo#38913: Prevent invalid parameter handler crashes" establishes a _set_invalid_parameter_handler (that outputs to std::wcerr and then returns), so one would assume that calling fileno(nullptr) would not abort via MSVCR's _invalid_parameter_noinfo (see <<a href="http://crashreport.libreoffice.org/stats/crash_details/8e1e262d-3281-431c-89b5-a5642033fe94" rel="noreferrer" target="_blank">http://crashreport.libreoffice.org/stats/crash_details/8e1e262d-3281-431c-89b5-a5642033fe94</a>>) but rather return EINVAL.<br>
</blockquote></div><br><br></div><div class="gmail_extra">If breakpad is enabled it overwrites the invalid parameter handler. We can of course change that behavior (just a different flag to the breakpad init code) but at least I think that it is a good thing to not ignore these errors.<br><br></div><div class="gmail_extra">Regards,<br></div><div class="gmail_extra">Markus<br></div></div>