Commit c226fd69 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder
Browse files

Don't crash if blip->type ends up NULL. Fixes crash from #321009.

2005-11-08  Morten Welinder  <terra@gnome.org>

	* ms-excel-write.c (blipinf_new): Don't crash if blip->type ends
	up NULL.  Fixes crash from #321009.
parent 5609f033
......@@ -21,7 +21,8 @@ Morten:
* Import column widths and row heights from Lotus 1-2-3 files.
* Read basic info from wk4 files.
* Fix issues with new function docs method.
* Fix OO import crash. [#320818.]
* Fix OO import crash. [#320818]
* Fix Excel save crash. [#321009]
Philippe Lelong:
* Fix issue with PRICE (and probably related functions).
......
2005-11-08 Morten Welinder <terra@gnome.org>
* ms-excel-write.c (blipinf_new): Don't crash if blip->type ends
up NULL. Fixes crash from #321009.
2005-11-05 Jody Goldberg <jody@gnome.org>
* excel-xml-read.c : Support DateTime values
......
......@@ -3722,6 +3722,7 @@ blipinf_new (SheetObjectImage *soi)
{
BlipInf *blip;
GByteArray *bytes;
const char *blip_type;
blip = g_new0 (BlipInf, 1);
blip->uncomp_len = -1;
......@@ -3733,14 +3734,15 @@ blipinf_new (SheetObjectImage *soi)
"image-data", &bytes,
NULL);
blip->bytes = *bytes; /* Need to copy, we may change it. */
if (strcmp (blip->type, "jpeg") == 0 || /* Raster format */
strcmp (blip->type, "png") == 0 || /* understood by Excel */
strcmp (blip->type, "dib") == 0) {
blip_type = blip->type ? blip->type : "?";
if (strcmp (blip_type, "jpeg") == 0 || /* Raster format */
strcmp (blip_type, "png") == 0 || /* understood by Excel */
strcmp (blip_type, "dib") == 0) {
blip->header_len = BSE_HDR_LEN + RASTER_BLIP_HDR_LEN;
} else if (strcmp (blip->type, "wmf") == 0 || /* Vector format */
strcmp (blip->type, "emf") == 0 || /* - compress */
strcmp (blip->type, "pict") == 0) {
} else if (strcmp (blip_type, "wmf") == 0 || /* Vector format */
strcmp (blip_type, "emf") == 0 || /* - compress */
strcmp (blip_type, "pict") == 0) {
int res;
gulong dest_len = blip->bytes.len * 1.01 + 12;
......@@ -3783,7 +3785,7 @@ blipinf_new (SheetObjectImage *soi)
} else {
g_warning
("Unable to export %s image as png to Excel",
blip->type);
blip_type);
g_free (blip);
blip = NULL;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment