0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.119.157.233


Current Path : /var/www/html/suk_discontinued/libgd-gd-2.2.3/tests/png/
Upload File :
Current File : /var/www/html/suk_discontinued/libgd-gd-2.2.3/tests/png/bug00193.c

#include <stdlib.h>
#include "gd.h"
#include "gdhelpers.h"
#include "gdtest.h"

static gdImagePtr im;

#define TERMINATE(ctx, status) do {				\
		free(ctx);							\
		gdImageDestroy(im);						\
		exit(status);							\
	} while (0)

static void
failPutC(gdIOCtxPtr ctx, int c)
{
	(void)c;
	TERMINATE(ctx, 1);
}

static int
failPutBuf(gdIOCtxPtr ctx, const void * data, int size)
{
	(void)data;
	(void)size;
	TERMINATE(ctx, 1);
	return -1;
}

int main()
{
	gdIOCtxPtr ctx;

	gdSetErrorMethod(gdSilence);

	im = gdImageCreate(100, 100);
	ctx = (gdIOCtxPtr)malloc(sizeof(gdIOCtx));
	ctx->putC   = failPutC;
	ctx->putBuf = failPutBuf;
	gdImagePngCtx(im, ctx);
	TERMINATE(ctx, 0);
	return 0;
}