php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
gd_compat.c
Go to the documentation of this file.
1#ifdef HAVE_CONFIG_H
2#include <config.h>
3#else
4#include <php_config.h>
5#endif
6
7#include "gd_compat.h"
8#include "php.h"
9
10int overflow2(int a, int b)
11{
12
13 if(a <= 0 || b <= 0) {
14 php_error_docref(NULL, E_WARNING, "One parameter to a memory allocation multiplication is negative or zero, failing operation gracefully\n");
15 return 1;
16 }
17 if(a > INT_MAX / b) {
18 php_error_docref(NULL, E_WARNING, "Product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully\n");
19 return 1;
20 }
21 return 0;
22}
int overflow2(int a, int b)
Definition gd_compat.c:10
#define NULL
Definition gdcache.h:45
PHPAPI ZEND_COLD void php_error_docref(const char *docref, int type, const char *format,...)
Definition main.c:1173
#define INT_MAX
Definition php.h:237
$obj a
Definition test.php:84
#define E_WARNING
Definition zend_errors.h:24