From f310036536181de0c007606e20cf3ae2c2db9fa0 Mon Sep 17 00:00:00 2001 From: John Tytgat Date: Sun, 2 May 2004 14:49:28 +0000 Subject: [project @ 2004-05-02 14:49:28 by joty] Corrupted PNG files will no longer result in assert() calling. See test suite at http://www.schaik.com/pngsuite/pngsuite.html. svn path=/import/netsurf/; revision=815 --- riscos/png.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'riscos') diff --git a/riscos/png.c b/riscos/png.c index e6e6c3019..c8fe028b4 100644 --- a/riscos/png.c +++ b/riscos/png.c @@ -48,7 +48,10 @@ void nspng_create(struct content *c, const char *params[]) if (setjmp(png_jmpbuf(c->data.png.png))) { png_destroy_read_struct(&c->data.png.png, &c->data.png.info, 0); - assert(0); + LOG(("Failed to set callbacks")); + c->data.png.png = NULL; + c->data.png.info = NULL; + return; } png_set_progressive_read_fn(c->data.png.png, c, @@ -61,7 +64,10 @@ void nspng_process_data(struct content *c, char *data, unsigned long size) if (setjmp(png_jmpbuf(c->data.png.png))) { png_destroy_read_struct(&c->data.png.png, &c->data.png.info, 0); - assert(0); + LOG(("Failed to process data")); + c->data.png.png = NULL; + c->data.png.info = NULL; + return; } LOG(("data %p, size %li", data, size)); @@ -219,6 +225,9 @@ void end_callback(png_structp png, png_infop info) int nspng_convert(struct content *c, unsigned int width, unsigned int height) { + if (c->data.png.png == NULL || c->data.png.info == NULL) + return 1; + png_destroy_read_struct(&c->data.png.png, &c->data.png.info, 0); c->title = xcalloc(100, 1); -- cgit v1.2.3