summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gd2/bug00354.c
blob: 8dc27cc5ad0395e3a3d26677675f8e02ca60f341 (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
31
32
/**
 * We're testing GD2 image files which report illegal chunk counts. These should
 * not cause integer overflows or other issues, but instead simply fail to be
 * loaded.
 *
 * See also <https://github.com/libgd/libgd/issues/354>.
 */


#include "gd.h"
#include "gdtest.h"


int main()
{
    gdImagePtr im;
    FILE *fp;

    fp = gdTestFileOpen2("gd2", "bug00354a.gd2");
    gdTestAssert(fp != NULL);
    im = gdImageCreateFromGd2(fp);
    gdTestAssert(im == NULL);
    fclose(fp);

    fp = gdTestFileOpen2("gd2", "bug00354b.gd2");
    gdTestAssert(fp != NULL);
    im = gdImageCreateFromGd2(fp);
    gdTestAssert(im == NULL);
    fclose(fp);

    return gdNumFailures();
}