Note that there are some explanatory texts on larger screens.

plurals
  1. POIsolating unmanaged crashes under Mono
    primarykey
    data
    text
    <p>We have a Mono application under Linux that does image processing on a bunch of files.</p> <p>For this we (among other things) use System.Drawing, and for the most part it serves us well. Occasionally however, we encounter an image that crashes the application - it is a crash in a native call, and this is immune to try catch. Simplified, a call like</p> <pre><code>System.Drawing.Image.FromFile(imagePath); </code></pre> <p>will cause a crash. The error message looks something like this:</p> <pre><code>at (wrapper managed-to-native) System.Drawing.GDIPlus.GdipLoadImageFromFile (string,intptr&amp;) &lt;0xffffffff&gt; </code></pre> <p>This pulls the whole application down instantly.</p> <p>We have encountered a few instances that this happens - corrupt GIF files, unexpected headers in TIFF files - to name a few. As we don't have control over the source of the images, we will just have to deal with possible crashes.</p> <p><strong>The question:</strong> I would like to isolate the places where we use GDI+ (through System.Drawing) on untrusted files so that it can happily crash without killing the whole application. </p> <p>I have attempted this through using separate application domains, but I just can't stop the crashes. It is probable that I am doing it wrong!</p> <p><sub> Some detail: openSUSE 11.4 (x86_64), Mono version 2.10.2, libgdiplus0 (package) 2.10-30.2, libtiff3 (package) 3.9.4-3.7.1 </sub></p> <hr> <p>Please note that the specific issues we experienced was promptly fixed - see comments below. The question still remains though. </p> <p>I would have liked to somehow isolate a part of the program so that it does not pull the whole thing down - but I fear the only answer is to call a external process as noted in the answer below. I'll leave this as is for a while and then accept that answer!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload