add: if (width > (INT_MAX/4)/height+4) { RErrorCode = RERR_NOMEMORY; return NULL; }
context: RCreateImage(unsigned width, unsigned height, int alpha){    RImage *image=NULL;        assert(width>0 && height>0);    image = malloc(sizeof(RImage));    if (!image) {	RErrorCode = RERR_NOMEMORY;        return NULL;    }    memset(image, 0, sizeof(RImage));    image->width = width;    image->height = height;    image->format = alpha ? RRGBAFormat : RRGBFormat;    image->refCount = 1;    /* the +4 is to give extra bytes at the end of the buffer,     * so that we can optimize image conversion for MMX(tm).. see convert.c     */    image->data = malloc(width * height * (alpha ? 4 : 3) + 4);    if (!image->data) {	RErrorCode = RERR_NOMEMORY;	free(image);	image = NULL;    }    return image;}