diff options
author | dinoex <dinoex@FreeBSD.org> | 2010-09-27 01:50:22 +0800 |
---|---|---|
committer | dinoex <dinoex@FreeBSD.org> | 2010-09-27 01:50:22 +0800 |
commit | 18040f7827238acb995ad2d612dc4fc34c1eb9f3 (patch) | |
tree | 28132c5aa486fd1a7bd86c1504d52f4fbd36fa7f /news/knews | |
parent | 2af525935c53f2443bb74c1c9903b7142cd927e1 (diff) | |
download | freebsd-ports-gnome-18040f7827238acb995ad2d612dc4fc34c1eb9f3.tar.gz freebsd-ports-gnome-18040f7827238acb995ad2d612dc4fc34c1eb9f3.tar.zst freebsd-ports-gnome-18040f7827238acb995ad2d612dc4fc34c1eb9f3.zip |
- fix crash on png files
Submitted by: Joerg Wunsch
- add LICENSE
Diffstat (limited to 'news/knews')
-rw-r--r-- | news/knews/Makefile | 4 | ||||
-rw-r--r-- | news/knews/files/patch-png.c | 76 | ||||
-rw-r--r-- | news/knews/pkg-descr | 2 |
3 files changed, 56 insertions, 26 deletions
diff --git a/news/knews/Makefile b/news/knews/Makefile index 1f9dd2c26ae3..7e928d621580 100644 --- a/news/knews/Makefile +++ b/news/knews/Makefile @@ -7,7 +7,7 @@ PORTNAME= knews PORTVERSION= 1.0b.1 -PORTREVISION= 10 +PORTREVISION= 11 CATEGORIES= news MASTER_SITES= http://www.matematik.su.se/~kjj/ @@ -19,6 +19,8 @@ LIB_DEPENDS= jpeg.11:${PORTSDIR}/graphics/jpeg \ compface:${PORTSDIR}/mail/faces RUN_DEPENDS= newsp:${PORTSDIR}/print/mp-letter +LICENSE= GPLv2 + USE_IMAKE= yes USE_XORG= xmu xpm xt sm ice xext x11 MAKE_FLAGS= BINDIR=${PREFIX}/bin MANDIR=${PREFIX}/man/man1 CC="${CC}" \ diff --git a/news/knews/files/patch-png.c b/news/knews/files/patch-png.c index b4b21ccb858b..999e7c7e5007 100644 --- a/news/knews/files/patch-png.c +++ b/news/knews/files/patch-png.c @@ -1,6 +1,8 @@ ---- src/png.c Sat Nov 21 09:55:13 1998 -+++ src/png.c Fri Jul 13 11:29:00 2001 -@@ -78,6 +78,12 @@ +--- src/png.c.orig 1998-11-21 15:55:13.000000000 +0100 ++++ src/png.c 2010-09-15 07:51:20.000000000 +0200 +@@ -76,10 +76,16 @@ + return fp; + } +static Pixmap rep_fail(const char *e) { + ArtTextAddLine(main_widgets.text, e, ascii_font->body_font, @@ -15,34 +17,42 @@ + png_structp png_ptr; + png_infop info_ptr; Pixmap pixmap; -@@ -94,9 +100,6 @@ + FILE *volatile vol_fp = NULL; + void *volatile vol_pic = NULL; +@@ -92,13 +98,21 @@ + + init_png_cmap(); - if (!(vol_fp = dump_for_png(data, len))) { - ArtTextAddLine(main_widgets.text, "[knews: temp file error.]", - ascii_font->body_font, global.alert_pixel); - return None; -- } + if (!(vol_fp = dump_for_png(data, len))) + return rep_fail("[knews: temp file error.]"); ++ ++ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, ++ NULL, NULL, NULL); ++ if (!png_ptr) ++ return rep_fail("[knews: can't allocate PNG structure.]"); ++ info_ptr = png_create_info_struct(png_ptr); ++ if (!info_ptr) { ++ png_destroy_read_struct(&png_ptr, ++ (png_infopp)NULL, (png_infopp)NULL); ++ return rep_fail("[knews: can't PNG info structure.]"); + } - if (setjmp(p_str.jmpbuf)) + if (setjmp(png_jmpbuf(png_ptr))) ArtTextAddLine(main_widgets.text, "[knews: png error.]", -@@ -110,18 +113,26 @@ + ascii_font->body_font, global.alert_pixel); + else { +@@ -108,58 +122,55 @@ + unsigned int per_line = 0; + unsigned int i, j, pass; - png_read_init(&p_str); - png_info_init(&p_info); -+ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, -+ NULL, NULL, NULL); -+ if (!png_ptr) -+ return rep_fail("[knews: can't allocate PNG structure.]"); -+ info_ptr = png_create_info_struct(png_ptr); -+ if (!info_ptr) { -+ png_destroy_read_struct(&png_ptr, -+ (png_infopp)NULL, (png_infopp)NULL); -+ return rep_fail("[knews: can't PNG info structure.]"); -+ } - +- - png_init_io(&p_str, vol_fp); - png_read_info(&p_str, &p_info); + png_init_io(png_ptr, vol_fp); @@ -67,12 +77,14 @@ + if (info_ptr->valid & PNG_INFO_bKGD) + png_set_background(png_ptr, &info_ptr->background, PNG_BACKGROUND_GAMMA_FILE, True, 1.0); -@@ -129,3 +140,3 @@ + else { static png_color_16 bg = {0, }; - png_set_background(&p_str, &bg, + png_set_background(png_ptr, &bg, PNG_BACKGROUND_GAMMA_SCREEN, False, 1.0); -@@ -135,10 +146,10 @@ + } + + per_line = w; - if (!(p_info.color_type & PNG_COLOR_MASK_COLOR)) { /* grey image */ + if (!(info_ptr->color_type & PNG_COLOR_MASK_COLOR)) { /* grey image */ @@ -88,7 +100,7 @@ - } else if (p_info.color_type & PNG_COLOR_MASK_PALETTE) { + } else if (info_ptr->color_type & PNG_COLOR_MASK_PALETTE) { CMAP_ENTRY *pal; -@@ -146,8 +157,8 @@ + int i, pn; - pn = p_info.num_palette; + pn = info_ptr->num_palette; @@ -101,30 +113,44 @@ + pal[i].g = info_ptr->palette[i].green; + pal[i].b = info_ptr->palette[i].blue; } -@@ -156,3 +167,3 @@ + vol_pal = pal; + vol_pn = pn; } else { - png_set_dither(&p_str, p_cmap, cmap_size, + png_set_dither(png_ptr, p_cmap, cmap_size, cmap_size, NULL, True); -@@ -160,4 +171,4 @@ + } - pass = png_set_interlace_handling(&p_str); - png_start_read_image(&p_str); + pass = png_set_interlace_handling(png_ptr); + png_start_read_image(png_ptr); -@@ -169,3 +180,3 @@ + vol_pic = pic = (unsigned char *)XtMalloc(h * per_line); + +@@ -167,14 +178,14 @@ + for (i = 0 ; i < pass ; i++) { + row = pic; for (j = 0 ; j < h ; j++) { - png_read_row(&p_str, NULL, row); + png_read_row(png_ptr, NULL, row); if (!did) -@@ -176,3 +187,3 @@ + vol_did = did = True; + row += per_line; + } + } - png_read_end(&p_str, NULL); + png_read_end(png_ptr, NULL); } -@@ -206,3 +217,3 @@ + + if (!vol_did) +@@ -204,7 +215,7 @@ + } + } - png_read_destroy(&p_str, &p_info, NULL); + png_read_destroy(png_ptr, info_ptr, NULL); fclose((FILE *)vol_fp); + XtFree((char *)vol_pic); + XtFree((char *)vol_pal); diff --git a/news/knews/pkg-descr b/news/knews/pkg-descr index cd341d018836..44e7d729662b 100644 --- a/news/knews/pkg-descr +++ b/news/knews/pkg-descr @@ -20,3 +20,5 @@ reading MIME articles, except message/partial. o article prefetch cache and 'trailing' cache o Less restrictive locking of the interface o Message-id lookup of articles + +LICENSE: GLP2 or later |