It is possible to make dia crash by resizing an image to nothing, and then
trying to grab it. This patch fixes the resulting floating point
exception.

dc

Daniel Cohn, InterNAP

Index: objects/standard/image.c
===================================================================
RCS file: /cvs/gnome/dia/objects/standard/image.c,v
retrieving revision 1.16
diff -c -r1.16 image.c
*** objects/standard/image.c    1999/10/03 15:07:58     1.16
--- objects/standard/image.c    1999/10/28 14:59:11
***************
*** 476,482 ****
      case HANDLE_RESIZE_SE:
        new_width = to->x-image->element.corner.x;
        new_height = to->y-image->element.corner.y;
!       if (new_width/new_height > width/height) {
        new_height = new_width*height/width;
        } else {
        new_width = new_height*width/height;
--- 476,482 ----
      case HANDLE_RESIZE_SE:
        new_width = to->x-image->element.corner.x;
        new_height = to->y-image->element.corner.y;
!       if (new_height == 0 || new_width/new_height > width/height) {
        new_height = new_width*height/width;
        } else {
        new_width = new_height*width/height;

Reply via email to