-
Notifications
You must be signed in to change notification settings - Fork 0
/
resourceOverflow.c
54 lines (39 loc) · 1.28 KB
/
resourceOverflow.c
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define IM7
#ifdef IM7
#include <MagickWand/MagickWand.h>
#else
#include <wand/MagickWand.h>
#endif
int main(int argc,char **argv) {
MagickWand *magick_wand;
MagickBooleanType status;
PixelWand *pixel_wand;
MagickSizeType resource_size;
char formatString[1000];
printf("Size of MagickSizeType is %d \n",
sizeof(MagickSizeType)
);
sprintf(formatString, "MemoryResource : %%%s \n", MagickSizeFormat);
printf("Format string is %s\n", formatString);
MagickWandGenesis();
resource_size = MagickGetResourceLimit(MemoryResource);
printf(formatString, resource_size);
MagickSetResourceLimit(MemoryResource, 5000 * 5000);
resource_size = MagickGetResourceLimit(MemoryResource);
printf(formatString, resource_size);
MagickSetResourceLimit(MemoryResource, 50000 * 5000);
resource_size = MagickGetResourceLimit(MemoryResource);
printf(formatString, resource_size);
MagickSetResourceLimit(MemoryResource, 50000ULL * 50000);
resource_size = MagickGetResourceLimit(MemoryResource);
printf(formatString, resource_size);
MagickWandTerminus();
return(0);
}