~ubuntu-branches/ubuntu/intrepid/libgd2/intrepid-security

« back to all changes in this revision

Viewing changes to tests/png/bug00086.c

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-12-06 17:02:21 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20071206170221-0h9h2222a7lzrnj1
Tags: 2.0.35.dfsg-3ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Drop unnecessary build dependency 'gnulib'.
  - maintainer field updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: bug00086.c,v 1.1.2.1 2007/05/17 14:38:24 pajoye Exp $ */
 
2
/* id: gdbad3.c, Xavier Roche, May. 2007 */
 
3
/* gcc gdbad3.c -o bad -lgd && ./bad */
 
4
 
 
5
#include <stdio.h>
 
6
#include <stdlib.h>
 
7
#include "gd.h"
 
8
 
 
9
static const unsigned char pngdata[93];
 
10
int main(void) {
 
11
        FILE *fp;
 
12
        gdImagePtr im;
 
13
        int i;
 
14
        size_t out;
 
15
 
 
16
        if ( ( im = gdImageCreateFromPngPtr(93, (char*) &pngdata[0]) ) == NULL) {
 
17
                fprintf(stderr, "success!\n");
 
18
                return 0;
 
19
        } else {
 
20
                fprintf(stderr, "failed!\n");
 
21
                gdImageDestroy(im);
 
22
                return 1;
 
23
        }
 
24
        return 0;
 
25
}
 
26
 
 
27
/* PNG data */
 
28
static const unsigned char pngdata[93] = {137,80,78,71,13,10,26,10,0,0,
 
29
0,13,73,72,68,82,0,0,0,120,0,0,0,131,8,6,0,0,0,70,49,223,8,0,0,0,6,98,
 
30
75,71,68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,92,
 
31
70,0,0,92,70,1,20,148,67,65,0,0,0,9,118,112,65,103,0,0,0,120,0,0,0,131,
 
32
0,226,13,249,45};
 
33