sgreader
sgreader copied to clipboard
Crash [Mac OS X]
Hi, I am trying to extract images from Empreror's files, but application crashes: Log: http://pastebin.com/BAdWVJfW
sg3: https://www.dropbox.com/s/l6ariapqfuh4uej/SprAmbient.sg3 .555: https://www.dropbox.com/s/jjtzmpe3xo74qp9/SprAmbient.555 image # 3305
Got the same issue with Pharaoh files.
Seems the problem comes from a unchecked return value at https://github.com/lclarkmichalek/sgreader/blob/libsg/src/gui/extractthread.cpp#L90 (According to lib code, sg_load_image_data can return NULL).
I added if (sgData == NULL) {continue ;} between line 91-92 and the program exited without errors. (but seems the malloc at https://github.com/lclarkmichalek/libsg/blob/master/c/sgimage.c#L277 is not safe: invalid read/write in memory)
Looks like there are quite a few issues there, and at least one memory leak. I don't have Emperor or Pharaoh, but I can try and fix up the obvious issues and see if that helps
Strange sg3 file. Bitmap section looks fine, but image seems odd. At offset 11880 (680 header + 200 bitmap * 56) it's just nulls until 40752. Pecunia's reverse engineering says that we should expect one null image record after the bitmap section, but I've not seen that range of non nulls before.
Scratch that, it's actually 680 + 200 * 200, as this isn't 0xd3, which has max 100 bitmaps