diff options
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/base_memory.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fitz/base_memory.c b/fitz/base_memory.c index 4153f31e..b7ebb2c9 100644 --- a/fitz/base_memory.c +++ b/fitz/base_memory.c @@ -19,6 +19,9 @@ fz_calloc(int count, int size) { void *p; + if (count == 0 || size == 0) + return 0; + if (count > INT_MAX / size) { fprintf(stderr, "fatal error: out of memory (integer overflow)\n"); @@ -39,6 +42,9 @@ fz_realloc(void *p, int count, int size) { void *np; + if (count == 0 || size == 0) + return p; + if (count > INT_MAX / size) { fprintf(stderr, "fatal error: out of memory (integer overflow)\n"); |