summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Tytgat <joty@netsurf-browser.org>2004-05-02 14:49:28 +0000
committerJohn Tytgat <joty@netsurf-browser.org>2004-05-02 14:49:28 +0000
commitf310036536181de0c007606e20cf3ae2c2db9fa0 (patch)
treee381ccc49bece2dea18be60479f34f7ad9e88b57
parent51bea40b9a1bb15ba148ab3e939f9935d0c65e04 (diff)
downloadnetsurf-f310036536181de0c007606e20cf3ae2c2db9fa0.tar.gz
netsurf-f310036536181de0c007606e20cf3ae2c2db9fa0.tar.bz2
[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
-rw-r--r--riscos/png.c13
1 files changed, 11 insertions, 2 deletions
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);