- bring in a patch from Debian to fix a SIGABRT on startup

issue noticed by todd@
This commit is contained in:
ajacoutot 2008-11-08 17:13:08 +00:00
parent 2f18fe683a
commit 604917d4c4
2 changed files with 33 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.7 2008/11/08 13:15:43 ajacoutot Exp $
# $OpenBSD: Makefile,v 1.8 2008/11/08 17:13:08 ajacoutot Exp $
COMMENT= 3D earth viewer with GPS support
DISTNAME= gaia-0.1.2
PKGNAME= ${DISTNAME}p4
PKGNAME= ${DISTNAME}p5
CATEGORIES= x11 geo
EXTRACT_SUFX= .tar.bz2

View File

@ -0,0 +1,31 @@
$OpenBSD: patch-lib_wwfetch_wwfetch_image_c,v 1.1 2008/11/08 17:13:08 ajacoutot Exp $
--- lib/wwfetch/wwfetch_image.c.orig Wed Nov 29 04:21:14 2006
+++ lib/wwfetch/wwfetch_image.c Sat Nov 8 18:01:51 2008
@@ -27,6 +27,9 @@
* @param level level of image [0..]
*/
wwfetch_error wwfetch_fetch_image(wwfetch *handle, int x, int y, int level) {
+ if (level > 14)
+ return WWFETCH_NOT_FOUND;
+
int res = 1 << (level);
double x1 = (double)(x)/(double)(res) * 360.0 - 180.0;
@@ -36,8 +39,16 @@ wwfetch_error wwfetch_fetch_image(wwfetch *handle, int
/* form full url */
char urlbuf[1024];
- if (snprintf(urlbuf, sizeof(urlbuf), "http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic_base&srs=EPSG:4326&width=256&height=256&bbox=%f,%f,%f,%f&format=image/jpeg&version=1.1.0&styles=", x1, y1, x2, y2) >= sizeof(urlbuf))
+ if (snprintf(urlbuf, sizeof(urlbuf), "http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&layers=global_mosaic&srs=EPSG:4326&width=512&height=512&bbox=%f,%f,%f,%f&format=image/jpeg&version=1.1.0&styles=", x1, y1, x2, y2) >= sizeof(urlbuf))
return WWFETCH_SMALL_BUFFER;
+
+ wwfetch_error result = wwfetch_fetch(handle, urlbuf);
+ if (result == WWFETCH_OK) {
+ if (handle->currentsize < 4 || handle->currentdata[0] != 0xff ||
+ handle->currentdata[1] != 0xd8 || handle->currentdata[2] != 0xff ||
+ handle->currentdata[3] != 0xe0)
+ return WWFETCH_FETCH_FAILED;
+ }
return wwfetch_fetch(handle, urlbuf);
}