This patch provides a partial fix for bug 2368.

The second image in the cited URL is CMY, and the libraries fail to
convert it.  The resulting bitmap is null.  It is rendered as a
pink rectangle.  If the user tries to export it as a sprite,
riscos_bitmap_save() is called, which immediately attempts a null
dereference, causing a crash (when I tried it, it was a serious
crash that brought the whole machine down).

The simple fix is to test for a null bitmap and, if so, warn the
user and go no further.

Longer term of course we should enhance the libraries so that the
coversion does not fail.

Dave


diff --git a/riscos/bitmap.c b/riscos/bitmap.c
index 384895d..38d69f4 100644
--- a/riscos/bitmap.c
+++ b/riscos/bitmap.c
@@ -272,6 +272,11 @@ bool riscos_bitmap_save(void *vbitmap, const char *path, 
unsigned flags)
        struct bitmap *bitmap = (struct bitmap *) vbitmap;
        os_error *error;
 
+       if (bitmap == NULL)
+       {
+               warn_user("SaveError", "Object is null");
+               return false;
+       }
        if (!bitmap->sprite_area) {
                riscos_bitmap_get_buffer(bitmap);
        }

____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.
Check it out at http://mysecurelogon.com/password-manager

Reply via email to