Update of /cvsroot/ufraw/ufraw In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv31535
Modified Files: ufraw_preview.c Log Message: Fix bugs #387-388: Fix divide-by-zero crashes. Thanks goes to Frank Markesteijn for finding these bugs. Index: ufraw_preview.c =================================================================== RCS file: /cvsroot/ufraw/ufraw/ufraw_preview.c,v retrieving revision 1.378 retrieving revision 1.379 diff -u -d -r1.378 -r1.379 --- ufraw_preview.c 26 Aug 2014 03:00:39 -0000 1.378 +++ ufraw_preview.c 27 Aug 2014 03:45:14 -0000 1.379 @@ -1302,6 +1302,7 @@ gtk_widget_queue_draw(data->LiveHisto); int CropCount = Crop.width * Crop.height; + if (CropCount == 0) CropCount = 1; // Bug #387: Fix divide-by-zero crash. for (c = 0; c < 3; c++) rgb[c] = sum[c] / CropCount; color_labels_set(data->AvrLabels, rgb); @@ -1980,7 +1981,9 @@ data->width = croppedWidth / data->shrink; } else { int size = floor(MAX(data->height, data->width) + 0.5); - if (croppedHeight > croppedWidth) { + if (size == 0 || (croppedHeight == 0 && croppedWidth == 0)) + data->height = data->width = data->shrink = 0; + else if (croppedHeight > croppedWidth) { data->height = size; data->width = size * croppedWidth / croppedHeight; data->shrink = (double)croppedHeight / size; ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ ufraw-cvs mailing list ufraw-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ufraw-cvs