aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorFumitoshi UKAI <ukai@debian.or.jp>2002-11-15 15:56:36 +0000
committerFumitoshi UKAI <ukai@debian.or.jp>2002-11-15 15:56:36 +0000
commit6a9b87edf9f730c221762dbe3dceea7f7a71bc08 (patch)
treeb95f5007f381817db044ffad17e19b36d54af8c8 /file.c
parent[w3m-dev 03435] save image with SAVE (diff)
downloadw3m-6a9b87edf9f730c221762dbe3dceea7f7a71bc08.tar.gz
w3m-6a9b87edf9f730c221762dbe3dceea7f7a71bc08.zip
[w3m-dev 03436] Check image size
* file.c (process_img): check w > MAX_IMAGE_SIZE (HTMLlineproc2body): check w,h > MAX_IMAGE_SIZE * fm.h (MAX_IMAGE_SIZE): added * image.c (getImageSize): check w,h,width,height > MAX_IMAGE_SIZE From: Hiroyuki Ito <hito@crl.go.jp>
Diffstat (limited to 'file.c')
-rw-r--r--file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/file.c b/file.c
index e4a723f..c4eaa09 100644
--- a/file.c
+++ b/file.c
@@ -1,4 +1,4 @@
-/* $Id: file.c,v 1.118 2002/11/15 15:51:23 ukai Exp $ */
+/* $Id: file.c,v 1.119 2002/11/15 15:56:36 ukai Exp $ */
#include "fm.h"
#include <sys/types.h>
#include "myctype.h"
@@ -2926,6 +2926,8 @@ process_img(struct parsed_tag *tag, int width)
w = (int)(w * image_scale / 100 + 0.5);
if (w == 0)
w = 1;
+ else if (w > MAX_IMAGE_SIZE)
+ w = MAX_IMAGE_SIZE;
}
}
#endif
@@ -2938,6 +2940,8 @@ process_img(struct parsed_tag *tag, int width)
i = (int)(i * image_scale / 100 + 0.5);
if (i == 0)
i = 1;
+ else if (i > MAX_IMAGE_SIZE)
+ i = MAX_IMAGE_SIZE;
}
else {
i = -1;
@@ -4949,8 +4953,8 @@ HTMLlineproc2body(Buffer *buf, Str (*feed) (), int llimit)
image->url = parsedURL2Str(&u)->ptr;
image->ext = filename_extension(u.file, TRUE);
image->cache = NULL;
- image->width = w;
- image->height = h;
+ image->width = (w > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE: w;
+ image->height = (h > MAX_IMAGE_SIZE) ? MAX_IMAGE_SIZE: h;
image->xoffset = xoffset;
image->yoffset = yoffset;
image->y = currentLn(buf) - top;