summaryrefslogtreecommitdiff
path: root/graphics/imlib2/patches/patch-ca
blob: b487d29517bc36babdb40ef1c59826a6198cd5b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$NetBSD: patch-ca,v 1.1 2006/11/24 12:46:12 drochner Exp $

--- src/modules/loaders/loader_argb.c.orig	2006-09-05 02:37:07.000000000 +0200
+++ src/modules/loaders/loader_argb.c
@@ -23,7 +23,7 @@ char
 load(ImlibImage * im, ImlibProgressFunction progress,
      char progress_granularity, char immediate_load)
 {
-   int                 w, h, alpha;
+   int                 w=0, h=0, alpha=0;
    FILE               *f;
 
    if (im->data)
@@ -36,13 +36,15 @@ load(ImlibImage * im, ImlibProgressFunct
    {
       char                buf[256], buf2[256];
 
+      memset(buf, 0, sizeof(buf));
+      memset(buf2, 0, sizeof(buf));
       if (!fgets(buf, 255, f))
         {
            fclose(f);
            return 0;
         }
       sscanf(buf, "%s %i %i %i", buf2, &w, &h, &alpha);
-      if (strcmp(buf2, "ARGB"))
+      if (strcmp(buf2, "ARGB") || w < 1 || h < 1 || w > 16383 || h > 16383)
         {
            fclose(f);
            return 0;