idx
int64
func_before
string
Vulnerability Classification
string
vul
int64
func_after
string
patch
string
CWE ID
string
lines_before
string
lines_after
string
45,100
static int sapi_extract_response_code(const char *header_line) { int code = 200; const char *ptr; for (ptr = header_line; *ptr; ptr++) { if (*ptr == ' ' && *(ptr + 1) != ' ') { code = atoi(ptr + 1); break; } } return code; }
XSS
0
static int sapi_extract_response_code(const char *header_line) { int code = 200; const char *ptr; for (ptr = header_line; *ptr; ptr++) { if (*ptr == ' ' && *(ptr + 1) != ' ') { code = atoi(ptr + 1); break; } } return code; }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,101
SAPI_API int sapi_flush(TSRMLS_D) { if (sapi_module.flush) { sapi_module.flush(SG(server_context)); return SUCCESS; } else { return FAILURE; } }
XSS
0
SAPI_API int sapi_flush(TSRMLS_D) { if (sapi_module.flush) { sapi_module.flush(SG(server_context)); return SUCCESS; } else { return FAILURE; } }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,102
SAPI_API int sapi_force_http_10(TSRMLS_D) { if (sapi_module.force_http_10) { return sapi_module.force_http_10(TSRMLS_C); } else { return FAILURE; } }
XSS
0
SAPI_API int sapi_force_http_10(TSRMLS_D) { if (sapi_module.force_http_10) { return sapi_module.force_http_10(TSRMLS_C); } else { return FAILURE; } }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,103
SAPI_API char *sapi_get_default_content_type(TSRMLS_D) { uint len; return get_default_content_type(0, &len TSRMLS_CC); }
XSS
0
SAPI_API char *sapi_get_default_content_type(TSRMLS_D) { uint len; return get_default_content_type(0, &len TSRMLS_CC); }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,104
SAPI_API int sapi_get_fd(int *fd TSRMLS_DC) { if (sapi_module.get_fd) { return sapi_module.get_fd(fd TSRMLS_CC); } else { return FAILURE; } }
XSS
0
SAPI_API int sapi_get_fd(int *fd TSRMLS_DC) { if (sapi_module.get_fd) { return sapi_module.get_fd(fd TSRMLS_CC); } else { return FAILURE; } }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,105
SAPI_API double sapi_get_request_time(TSRMLS_D) { if(SG(global_request_time)) return SG(global_request_time); if (sapi_module.get_request_time && SG(server_context)) { SG(global_request_time) = sapi_module.get_request_time(TSRMLS_C); } else { struct timeval tp = {0}; if (!gettimeofday(&tp, NULL)) { SG(glob...
XSS
0
SAPI_API double sapi_get_request_time(TSRMLS_D) { if(SG(global_request_time)) return SG(global_request_time); if (sapi_module.get_request_time && SG(server_context)) { SG(global_request_time) = sapi_module.get_request_time(TSRMLS_C); } else { struct timeval tp = {0}; if (!gettimeofday(&tp, NULL)) { SG(glob...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,106
SAPI_API int sapi_get_target_uid(uid_t *obj TSRMLS_DC) { if (sapi_module.get_target_uid) { return sapi_module.get_target_uid(obj TSRMLS_CC); } else { return FAILURE; } }
XSS
0
SAPI_API int sapi_get_target_uid(uid_t *obj TSRMLS_DC) { if (sapi_module.get_target_uid) { return sapi_module.get_target_uid(obj TSRMLS_CC); } else { return FAILURE; } }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,107
SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC) { if (sapi_module.getenv) { char *value, *tmp = sapi_module.getenv(name, name_len TSRMLS_CC); if (tmp) { value = estrdup(tmp); } else { return NULL; } if (sapi_module.input_filter) { sapi_module.input_filter(PARSE_STRING, name, &valu...
XSS
0
SAPI_API char *sapi_getenv(char *name, size_t name_len TSRMLS_DC) { if (sapi_module.getenv) { char *value, *tmp = sapi_module.getenv(name, name_len TSRMLS_CC); if (tmp) { value = estrdup(tmp); } else { return NULL; } if (sapi_module.input_filter) { sapi_module.input_filter(PARSE_STRING, name, &valu...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,108
static void sapi_globals_ctor(sapi_globals_struct *sapi_globals TSRMLS_DC) { memset(sapi_globals, 0, sizeof(*sapi_globals)); zend_hash_init_ex(&sapi_globals->known_post_content_types, 5, NULL, NULL, 1, 0); php_setup_sapi_content_types(TSRMLS_C); }
XSS
0
static void sapi_globals_ctor(sapi_globals_struct *sapi_globals TSRMLS_DC) { memset(sapi_globals, 0, sizeof(*sapi_globals)); zend_hash_init_ex(&sapi_globals->known_post_content_types, 5, NULL, NULL, 1, 0); php_setup_sapi_content_types(TSRMLS_C); }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,109
static void sapi_globals_dtor(sapi_globals_struct *sapi_globals TSRMLS_DC) { zend_hash_destroy(&sapi_globals->known_post_content_types); }
XSS
0
static void sapi_globals_dtor(sapi_globals_struct *sapi_globals TSRMLS_DC) { zend_hash_destroy(&sapi_globals->known_post_content_types); }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,110
SAPI_API void sapi_handle_post(void *arg TSRMLS_DC) { if (SG(request_info).post_entry && SG(request_info).content_type_dup) { SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg TSRMLS_CC); if (SG(request_info).post_data) { efree(SG(request_info).post_data); SG(request_info).post...
XSS
0
SAPI_API void sapi_handle_post(void *arg TSRMLS_DC) { if (SG(request_info).post_entry && SG(request_info).content_type_dup) { SG(request_info).post_entry->post_handler(SG(request_info).content_type_dup, arg TSRMLS_CC); if (SG(request_info).post_data) { efree(SG(request_info).post_data); SG(request_info).post...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,111
static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_header TSRMLS_DC) { if (!sapi_module.header_handler || (SAPI_HEADER_ADD & sapi_module.header_handler(sapi_header, op, &SG(sapi_headers) TSRMLS_CC))) { if (op == SAPI_HEADER_REPLACE) { char *colon_offset = strchr(sapi_header->header,...
XSS
0
static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_header TSRMLS_DC) { if (!sapi_module.header_handler || (SAPI_HEADER_ADD & sapi_module.header_handler(sapi_header, op, &SG(sapi_headers) TSRMLS_CC))) { if (op == SAPI_HEADER_REPLACE) { char *colon_offset = strchr(sapi_header->header,...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,112
static void sapi_read_post_data(TSRMLS_D) { sapi_post_entry *post_entry; uint content_type_length = strlen(SG(request_info).content_type); char *content_type = estrndup(SG(request_info).content_type, content_type_length); char *p; char oldchar=0; void (*post_reader_func)(TSRMLS_D) = NULL; /* dedicated implemen...
XSS
0
static void sapi_read_post_data(TSRMLS_D) { sapi_post_entry *post_entry; uint content_type_length = strlen(SG(request_info).content_type); char *content_type = estrndup(SG(request_info).content_type, content_type_length); char *p; char oldchar=0; void (*post_reader_func)(TSRMLS_D) = NULL; /* dedicated implemen...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,113
SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC) { if (SG(sapi_started) && EG(in_execution)) { return FAILURE; } sapi_module.input_filter = input_fi...
XSS
0
SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, char *var, char **val, unsigned int val_len, unsigned int *new_val_len TSRMLS_DC), unsigned int (*input_filter_init)(TSRMLS_D) TSRMLS_DC) { if (SG(sapi_started) && EG(in_execution)) { return FAILURE; } sapi_module.input_filter = input_fi...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,114
static void sapi_remove_header(zend_llist *l, char *name, uint len) { sapi_header_struct *header; zend_llist_element *next; zend_llist_element *current=l->head; while (current) { header = (sapi_header_struct *)(current->data); next = current->next; if (header->header_len > len && header->header[len] == ':' ...
XSS
0
static void sapi_remove_header(zend_llist *l, char *name, uint len) { sapi_header_struct *header; zend_llist_element *next; zend_llist_element *current=l->head; while (current) { header = (sapi_header_struct *)(current->data); next = current->next; if (header->header_len > len && header->header[len] == ':' ...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,115
static void sapi_run_header_callback(TSRMLS_D) { int error; zend_fcall_info fci; char *callback_name = NULL; char *callback_error = NULL; zval *retval_ptr = NULL; if (zend_fcall_info_init(SG(callback_func), 0, &fci, &SG(fci_cache), &callback_name, &callback_error TSRMLS_CC) == SUCCESS) { fci.retval_ptr_ptr ...
XSS
0
static void sapi_run_header_callback(TSRMLS_D) { int error; zend_fcall_info fci; char *callback_name = NULL; char *callback_error = NULL; zval *retval_ptr = NULL; if (zend_fcall_info_init(SG(callback_func), 0, &fci, &SG(fci_cache), &callback_name, &callback_error TSRMLS_CC) == SUCCESS) { fci.retval_ptr_ptr ...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,116
SAPI_API int sapi_send_headers(TSRMLS_D) { int retval; int ret = FAILURE; if (SG(headers_sent) || SG(request_info).no_headers || SG(callback_run)) { return SUCCESS; } /* Success-oriented. We set headers_sent to 1 here to avoid an infinite loop * in case of an error situation. */ if (SG(sapi_headers).send...
XSS
0
SAPI_API int sapi_send_headers(TSRMLS_D) { int retval; int ret = FAILURE; if (SG(headers_sent) || SG(request_info).no_headers || SG(callback_run)) { return SUCCESS; } /* Success-oriented. We set headers_sent to 1 here to avoid an infinite loop * in case of an error situation. */ if (SG(sapi_headers).send...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,117
SAPI_API void sapi_shutdown(void) { #ifdef ZTS ts_free_id(sapi_globals_id); #else sapi_globals_dtor(&sapi_globals); #endif reentrancy_shutdown(); virtual_cwd_shutdown(); #ifdef PHP_WIN32 tsrm_win32_shutdown(); #endif }
XSS
0
SAPI_API void sapi_shutdown(void) { #ifdef ZTS ts_free_id(sapi_globals_id); #else sapi_globals_dtor(&sapi_globals); #endif reentrancy_shutdown(); virtual_cwd_shutdown(); #ifdef PHP_WIN32 tsrm_win32_shutdown(); #endif }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,118
SAPI_API void sapi_startup(sapi_module_struct *sf) { #ifdef ZEND_SIGNALS zend_signal_startup(); #endif sf->ini_entries = NULL; sapi_module = *sf; #ifdef ZTS ts_allocate_id(&sapi_globals_id, sizeof(sapi_globals_struct), (ts_allocate_ctor) sapi_globals_ctor, (ts_allocate_dtor) sapi_globals_dtor); # ifdef PHP_WIN32 ...
XSS
0
SAPI_API void sapi_startup(sapi_module_struct *sf) { #ifdef ZEND_SIGNALS zend_signal_startup(); #endif sf->ini_entries = NULL; sapi_module = *sf; #ifdef ZTS ts_allocate_id(&sapi_globals_id, sizeof(sapi_globals_struct), (ts_allocate_ctor) sapi_globals_ctor, (ts_allocate_dtor) sapi_globals_dtor); # ifdef PHP_WIN32 ...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,119
SAPI_API void sapi_terminate_process(TSRMLS_D) { if (sapi_module.terminate_process) { sapi_module.terminate_process(TSRMLS_C); } }
XSS
0
SAPI_API void sapi_terminate_process(TSRMLS_D) { if (sapi_module.terminate_process) { sapi_module.terminate_process(TSRMLS_C); } }
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,120
static void sapi_update_response_code(int ncode TSRMLS_DC) { /* if the status code did not change, we do not want to change the status line, and no need to change the code */ if (SG(sapi_headers).http_response_code == ncode) { return; } if (SG(sapi_headers).http_status_line) { efree(SG(sapi_headers).http_s...
XSS
0
static void sapi_update_response_code(int ncode TSRMLS_DC) { /* if the status code did not change, we do not want to change the status line, and no need to change the code */ if (SG(sapi_headers).http_response_code == ncode) { return; } if (SG(sapi_headers).http_status_line) { efree(SG(sapi_headers).http_s...
@@ -743,13 +743,8 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) /* new line/NUL character safety check */ int i; for (i = 0; i < header_line_len; i++) { - /* RFC 2616 allows new lines if followed by SP or HT */ - int illegal_break = - (header_line[i+1] != ' ' && header_lin...
CWE-79
null
null
45,121
BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height) { gdImagePtr im_scaled = NULL; if (src == NULL || src->interpolation_id < 0 || src->interpolation_id > GD_METHOD_COUNT) { return 0; } switch (src->interpolation_id) { /*Special cases, optimi...
DoS
0
BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int new_width, const unsigned int new_height) { gdImagePtr im_scaled = NULL; if (src == NULL || src->interpolation_id < 0 || src->interpolation_id > GD_METHOD_COUNT) { return 0; } switch (src->interpolation_id) { /*Special cases, optimi...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,122
BGD_DECLARE(gdImagePtr) gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor) { /* round to two decimals and keep the 100x multiplication to use it in the common square angles case later. Keep the two decimal precisions so smaller rotation steps can be done, useful for slow animation...
DoS
0
BGD_DECLARE(gdImagePtr) gdImageRotateInterpolated(const gdImagePtr src, const float angle, int bgcolor) { /* round to two decimals and keep the 100x multiplication to use it in the common square angles case later. Keep the two decimal precisions so smaller rotation steps can be done, useful for slow animation...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,123
BGD_DECLARE(gdInterpolationMethod) gdImageGetInterpolationMethod(gdImagePtr im) { return im->interpolation_id; }
DoS
0
BGD_DECLARE(gdInterpolationMethod) gdImageGetInterpolationMethod(gdImagePtr im) { return im->interpolation_id; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,124
static double KernelBessel_J1(const double x) { double p, q; register long i; static const double Pone[] = { 0.581199354001606143928050809e+21, -0.6672106568924916298020941484e+20, 0.2316433580634002297931815435e+19, -0.3588817569910106050743641413e+17, 0.2908795263834775409737601689e+15, -0.13229834...
DoS
0
static double KernelBessel_J1(const double x) { double p, q; register long i; static const double Pone[] = { 0.581199354001606143928050809e+21, -0.6672106568924916298020941484e+20, 0.2316433580634002297931815435e+19, -0.3588817569910106050743641413e+17, 0.2908795263834775409737601689e+15, -0.13229834...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,125
static double KernelBessel_Order1(double x) { double p, q; if (x == 0.0) return (0.0f); p = x; if (x < 0.0) x=(-x); if (x < 8.0) return (p*KernelBessel_J1(x)); q = (double)sqrt(2.0f/(M_PI*x))*(double)(KernelBessel_P1(x)*(1.0f/sqrt(2.0f)*(sin(x)-cos(x)))-8.0f/x*KernelBessel_Q1(x)* (-1.0f/sqrt(2.0f)*(sin(...
DoS
0
static double KernelBessel_Order1(double x) { double p, q; if (x == 0.0) return (0.0f); p = x; if (x < 0.0) x=(-x); if (x < 8.0) return (p*KernelBessel_J1(x)); q = (double)sqrt(2.0f/(M_PI*x))*(double)(KernelBessel_P1(x)*(1.0f/sqrt(2.0f)*(sin(x)-cos(x)))-8.0f/x*KernelBessel_Q1(x)* (-1.0f/sqrt(2.0f)*(sin(...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,126
static double KernelBessel_Q1(const double x) { double p, q; register long i; static const double Pone[] = { 0.3511751914303552822533318e+3, 0.7210391804904475039280863e+3, 0.4259873011654442389886993e+3, 0.831898957673850827325226e+2, 0.45681716295512267064405e+1, 0.3532840052740123642735e-1 }, Qo...
DoS
0
static double KernelBessel_Q1(const double x) { double p, q; register long i; static const double Pone[] = { 0.3511751914303552822533318e+3, 0.7210391804904475039280863e+3, 0.4259873011654442389886993e+3, 0.831898957673850827325226e+2, 0.45681716295512267064405e+1, 0.3532840052740123642735e-1 }, Qo...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,127
static inline LineContribType * _gdContributionsAlloc(unsigned int line_length, unsigned int windows_size) { unsigned int u = 0; LineContribType *res; res = (LineContribType *) gdMalloc(sizeof(LineContribType)); if (!res) { return NULL; } res->WindowSize = windows_size; res->LineLength = line_length; res->Co...
DoS
0
static inline LineContribType * _gdContributionsAlloc(unsigned int line_length, unsigned int windows_size) { unsigned int u = 0; LineContribType *res; res = (LineContribType *) gdMalloc(sizeof(LineContribType)); if (!res) { return NULL; } res->WindowSize = windows_size; res->LineLength = line_length; res->Co...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,128
static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter) { double width_d; double scale_f_d = 1.0; const double filter_width_d = DEFAULT_BOX_RADIUS; int windows_size; unsigned int u; LineContribType *res; if (scale_d ...
DoS
0
static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter) { double width_d; double scale_f_d = 1.0; const double filter_width_d = DEFAULT_BOX_RADIUS; int windows_size; unsigned int u; LineContribType *res; if (scale_d ...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,129
static inline void _gdContributionsFree(LineContribType * p) { unsigned int u; for (u = 0; u < p->LineLength; u++) { gdFree(p->ContribRow[u].Weights); } gdFree(p->ContribRow); gdFree(p); }
DoS
0
static inline void _gdContributionsFree(LineContribType * p) { unsigned int u; for (u = 0; u < p->LineLength; u++) { gdFree(p->ContribRow[u].Weights); } gdFree(p->ContribRow); gdFree(p); }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,130
_gdScaleOneAxis(gdImagePtr pSrc, gdImagePtr dst, unsigned int dst_len, unsigned int row, LineContribType *contrib, gdAxis axis) { unsigned int ndx; for (ndx = 0; ndx < dst_len; ndx++) { double r = 0, g = 0, b = 0, a = 0; const int left = contrib->ContribRow[ndx].Left; const int right = contrib->Contrib...
DoS
0
_gdScaleOneAxis(gdImagePtr pSrc, gdImagePtr dst, unsigned int dst_len, unsigned int row, LineContribType *contrib, gdAxis axis) { unsigned int ndx; for (ndx = 0; ndx < dst_len; ndx++) { double r = 0, g = 0, b = 0, a = 0; const int left = contrib->ContribRow[ndx].Left; const int right = contrib->Contrib...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,131
static double filter_bell(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x < 0.5) return (0.75 - x*x); if (x < 1.5) return (0.5 * pow(x - 1.5, 2.0)); return 0.0; }
DoS
0
static double filter_bell(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x < 0.5) return (0.75 - x*x); if (x < 1.5) return (0.5 * pow(x - 1.5, 2.0)); return 0.0; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,132
static double filter_bicubic(const double t) { const double abs_t = (double)fabs(t); const double abs_t_sq = abs_t * abs_t; if (abs_t<1) return 1-2*abs_t_sq+abs_t_sq*abs_t; if (abs_t<2) return 4 - 8*abs_t +5*abs_t_sq - abs_t_sq*abs_t; return 0; }
DoS
0
static double filter_bicubic(const double t) { const double abs_t = (double)fabs(t); const double abs_t_sq = abs_t * abs_t; if (abs_t<1) return 1-2*abs_t_sq+abs_t_sq*abs_t; if (abs_t<2) return 4 - 8*abs_t +5*abs_t_sq - abs_t_sq*abs_t; return 0; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,133
static double filter_box(double x) { if (x < - DEFAULT_FILTER_BOX) return 0.0f; if (x < DEFAULT_FILTER_BOX) return 1.0f; return 0.0f; }
DoS
0
static double filter_box(double x) { if (x < - DEFAULT_FILTER_BOX) return 0.0f; if (x < DEFAULT_FILTER_BOX) return 1.0f; return 0.0f; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,134
static double filter_bspline(const double x) { if (x>2.0f) { return 0.0f; } else { double a, b, c, d; /* Was calculated anyway cause the "if((x-1.0f) < 0)" */ const double xm1 = x - 1.0f; const double xp1 = x + 1.0f; const double xp2 = x + 2.0f; if ((xp2) <= 0.0f) a = 0.0f; else a = xp2*xp2*xp2; if (...
DoS
0
static double filter_bspline(const double x) { if (x>2.0f) { return 0.0f; } else { double a, b, c, d; /* Was calculated anyway cause the "if((x-1.0f) < 0)" */ const double xm1 = x - 1.0f; const double xp1 = x + 1.0f; const double xp2 = x + 2.0f; if ((xp2) <= 0.0f) a = 0.0f; else a = xp2*xp2*xp2; if (...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,135
static double filter_cubic_convolution(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; const double x2 = x1 * x1; const double x2_x = x2 * x; if (x <= 1.0) return ((4.0 / 3.0)* x2_x - (7.0 / 3.0) * x2 + 1.0); if (x <= 2.0) return (- (7.0 / 12.0) * x2_x + 3 * x2 - (59.0 / 12.0) * x + 2.5); if (x <= 3.0) ...
DoS
0
static double filter_cubic_convolution(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; const double x2 = x1 * x1; const double x2_x = x2 * x; if (x <= 1.0) return ((4.0 / 3.0)* x2_x - (7.0 / 3.0) * x2 + 1.0); if (x <= 2.0) return (- (7.0 / 12.0) * x2_x + 3 * x2 - (59.0 / 12.0) * x + 2.5); if (x <= 3.0) ...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,136
static double filter_cubic_spline(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x < 1.0 ) { const double x2 = x*x; return (0.5 * x2 * x - x2 + 2.0 / 3.0); } if (x < 2.0) { return (pow(2.0 - x, 3.0)/6.0); } return 0; }
DoS
0
static double filter_cubic_spline(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x < 1.0 ) { const double x2 = x*x; return (0.5 * x2 * x - x2 + 2.0 / 3.0); } if (x < 2.0) { return (pow(2.0 - x, 3.0)/6.0); } return 0; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,137
static double filter_filter(double t) { /* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */ if(t < 0.0) t = -t; if(t < 1.0) return((2.0 * t - 3.0) * t * t + 1.0); return(0.0); }
DoS
0
static double filter_filter(double t) { /* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */ if(t < 0.0) t = -t; if(t < 1.0) return((2.0 * t - 3.0) * t * t + 1.0); return(0.0); }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,138
static double filter_gaussian(const double x) { /* return(exp((double) (-2.0 * x * x)) * sqrt(2.0 / M_PI)); */ return (double)(exp(-2.0f * x * x) * 0.79788456080287f); }
DoS
0
static double filter_gaussian(const double x) { /* return(exp((double) (-2.0 * x * x)) * sqrt(2.0 / M_PI)); */ return (double)(exp(-2.0f * x * x) * 0.79788456080287f); }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,139
static double filter_generalized_cubic(const double t) { const double a = -DEFAULT_FILTER_GENERALIZED_CUBIC; double abs_t = (double)fabs(t); double abs_t_sq = abs_t * abs_t; if (abs_t < 1) return (a + 2) * abs_t_sq * abs_t - (a + 3) * abs_t_sq + 1; if (abs_t < 2) return a * abs_t_sq * abs_t - 5 * a * abs_t_sq + 8 ...
DoS
0
static double filter_generalized_cubic(const double t) { const double a = -DEFAULT_FILTER_GENERALIZED_CUBIC; double abs_t = (double)fabs(t); double abs_t_sq = abs_t * abs_t; if (abs_t < 1) return (a + 2) * abs_t_sq * abs_t - (a + 3) * abs_t_sq + 1; if (abs_t < 2) return a * abs_t_sq * abs_t - 5 * a * abs_t_sq + 8 ...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,140
static double filter_hamming(const double x) { /* should be (0.54+0.46*cos(M_PI*(double) x)); but this approximation is sufficient */ if (x < -1.0f) return 0.0f; if (x < 0.0f) return 0.92f*(-2.0f*x-3.0f)*x*x+1.0f; if (x < 1.0f) return 0.92f*(2.0f*x-3.0f)*x*x+1.0f; return 0.0f; }
DoS
0
static double filter_hamming(const double x) { /* should be (0.54+0.46*cos(M_PI*(double) x)); but this approximation is sufficient */ if (x < -1.0f) return 0.0f; if (x < 0.0f) return 0.92f*(-2.0f*x-3.0f)*x*x+1.0f; if (x < 1.0f) return 0.92f*(2.0f*x-3.0f)*x*x+1.0f; return 0.0f; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,141
static double filter_hanning(const double x) { /* A Cosine windowing function */ return(0.5 + 0.5 * cos(M_PI * x)); }
DoS
0
static double filter_hanning(const double x) { /* A Cosine windowing function */ return(0.5 + 0.5 * cos(M_PI * x)); }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,142
static double filter_lanczos3(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; #define R DEFAULT_LANCZOS3_RADIUS if ( x == 0.0) return 1; if ( x < R) { return R * sin(x*M_PI) * sin(x * M_PI / R) / (x * M_PI * x * M_PI); } return 0.0; #undef R }
DoS
0
static double filter_lanczos3(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; #define R DEFAULT_LANCZOS3_RADIUS if ( x == 0.0) return 1; if ( x < R) { return R * sin(x*M_PI) * sin(x * M_PI / R) / (x * M_PI * x * M_PI); } return 0.0; #undef R }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,143
static double filter_lanczos8(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; #define R DEFAULT_LANCZOS8_RADIUS if ( x == 0.0) return 1; if ( x < R) { return R * sin(x*M_PI) * sin(x * M_PI/ R) / (x * M_PI * x * M_PI); } return 0.0; #undef R }
DoS
0
static double filter_lanczos8(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; #define R DEFAULT_LANCZOS8_RADIUS if ( x == 0.0) return 1; if ( x < R) { return R * sin(x*M_PI) * sin(x * M_PI/ R) / (x * M_PI * x * M_PI); } return 0.0; #undef R }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,144
static double filter_quadratic(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x <= 0.5) return (- 2.0 * x * x + 1); if (x <= 1.5) return (x * x - 2.5* x + 1.5); return 0.0; }
DoS
0
static double filter_quadratic(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x <= 0.5) return (- 2.0 * x * x + 1); if (x <= 1.5) return (x * x - 2.5* x + 1.5); return 0.0; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,145
static double filter_quadratic_bspline(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x <= 0.5) return (- x * x + 0.75); if (x <= 1.5) return (0.5 * x * x - 1.5 * x + 1.125); return 0.0; }
DoS
0
static double filter_quadratic_bspline(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x <= 0.5) return (- x * x + 0.75); if (x <= 1.5) return (0.5 * x * x - 1.5 * x + 1.125); return 0.0; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,146
static double filter_sinc(const double x) { /* X-scaled Sinc(x) function. */ if (x == 0.0) return(1.0); return (sin(M_PI * (double) x) / (M_PI * (double) x)); }
DoS
0
static double filter_sinc(const double x) { /* X-scaled Sinc(x) function. */ if (x == 0.0) return(1.0); return (sin(M_PI * (double) x) / (M_PI * (double) x)); }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,147
static double filter_triangle(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x < 1.0) return (1.0 - x); return 0.0; }
DoS
0
static double filter_triangle(const double x1) { const double x = x1 < 0.0 ? -x1 : x1; if (x < 1.0) return (1.0 - x); return 0.0; }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,148
static double filter_welsh(const double x) { /* Welsh parabolic windowing filter */ if (x < 1.0) return(1 - x*x); return(0.0); }
DoS
0
static double filter_welsh(const double x) { /* Welsh parabolic windowing filter */ if (x < 1.0) return(1 - x*x); return(0.0); }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,149
void gdDumpRect(const char *msg, gdRectPtr r) { printf("%s (%i, %i) (%i, %i)\n", msg, r->x, r->y, r->width, r->height); }
DoS
0
void gdDumpRect(const char *msg, gdRectPtr r) { printf("%s (%i, %i) (%i, %i)\n", msg, r->x, r->y, r->width, r->height); }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,150
static void gdImageClipRectangle(gdImagePtr im, gdRectPtr r) { int c1x, c1y, c2x, c2y; int x1,y1; gdImageGetClip(im, &c1x, &c1y, &c2x, &c2y); x1 = r->x + r->width - 1; y1 = r->y + r->height - 1; r->x = CLAMP(r->x, c1x, c2x); r->y = CLAMP(r->y, c1y, c2y); r->width = CLAMP(x1, c1x, c2x) - r->x + 1; r->height =...
DoS
0
static void gdImageClipRectangle(gdImagePtr im, gdRectPtr r) { int c1x, c1y, c2x, c2y; int x1,y1; gdImageGetClip(im, &c1x, &c1y, &c2x, &c2y); x1 = r->x + r->width - 1; y1 = r->y + r->height - 1; r->x = CLAMP(r->x, c1x, c2x); r->y = CLAMP(r->y, c1y, c2y); r->width = CLAMP(x1, c1x, c2x) - r->x + 1; r->height =...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,151
gdImageRotateBicubicFixed(gdImagePtr src, const float degrees,const int bgColor) { const float _angle = (float)((- degrees / 180.0f) * M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const unsigned int new_width = abs((int)(src_w*cos(_angle))) + abs((int)(src_h*sin(_angle) + 0.5f)); cons...
DoS
0
gdImageRotateBicubicFixed(gdImagePtr src, const float degrees,const int bgColor) { const float _angle = (float)((- degrees / 180.0f) * M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const unsigned int new_width = abs((int)(src_w*cos(_angle))) + abs((int)(src_h*sin(_angle) + 0.5f)); cons...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,152
gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor) { float _angle = (float)((- degrees / 180.0f) * M_PI); const unsigned int src_w = gdImageSX(src); const unsigned int src_h = gdImageSY(src); unsigned int new_width = abs((int)(src_w*cos(_angle))) + abs((int)(src_h*sin(_angle) + 0.5f)); u...
DoS
0
gdImageRotateBilinear(gdImagePtr src, const float degrees, const int bgColor) { float _angle = (float)((- degrees / 180.0f) * M_PI); const unsigned int src_w = gdImageSX(src); const unsigned int src_h = gdImageSY(src); unsigned int new_width = abs((int)(src_w*cos(_angle))) + abs((int)(src_h*sin(_angle) + 0.5f)); u...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,153
gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor) { float _angle = ((float) (-degrees / 180.0f) * (float)M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const unsigned int new_width = (unsigned int)(abs((int)(src_w * cos(_angle))) + abs((int)(src_h * sin(_angle...
DoS
0
gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor) { float _angle = ((float) (-degrees / 180.0f) * (float)M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const unsigned int new_width = (unsigned int)(abs((int)(src_w * cos(_angle))) + abs((int)(src_h * sin(_angle...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,154
gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigned int height) { const long new_width = MAX(1, width); const long new_height = MAX(1, height); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const gdFixed f_dx = gd_ftofx((float)src_w / (fl...
DoS
0
gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigned int height) { const long new_width = MAX(1, width); const long new_height = MAX(1, height); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const gdFixed f_dx = gd_ftofx((float)src_w / (fl...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,155
gdImageScaleBilinear(gdImagePtr im, const unsigned int new_width, const unsigned int new_height) { if (im->trueColor) { return gdImageScaleBilinearTC(im, new_width, new_height); } else { return gdImageScaleBilinearPalette(im, new_width, new_height); } }
DoS
0
gdImageScaleBilinear(gdImagePtr im, const unsigned int new_width, const unsigned int new_height) { if (im->trueColor) { return gdImageScaleBilinearTC(im, new_width, new_height); } else { return gdImageScaleBilinearPalette(im, new_width, new_height); } }
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,156
static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int new_width, const unsigned int new_height) { long _width = MAX(1, new_width); long _height = MAX(1, new_height); float dx = (float)gdImageSX(im) / (float)_width; float dy = (float)gdImageSY(im) / (float)_height; gdFixed f_dx = gd_ftofx(...
DoS
0
static gdImagePtr gdImageScaleBilinearPalette(gdImagePtr im, const unsigned int new_width, const unsigned int new_height) { long _width = MAX(1, new_width); long _height = MAX(1, new_height); float dx = (float)gdImageSX(im) / (float)_width; float dy = (float)gdImageSY(im) / (float)_height; gdFixed f_dx = gd_ftofx(...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,157
static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_width, const unsigned int new_height) { long dst_w = MAX(1, new_width); long dst_h = MAX(1, new_height); float dx = (float)gdImageSX(im) / (float)dst_w; float dy = (float)gdImageSY(im) / (float)dst_h; gdFixed f_dx = gd_ftofx(dx); gdFix...
DoS
0
static gdImagePtr gdImageScaleBilinearTC(gdImagePtr im, const unsigned int new_width, const unsigned int new_height) { long dst_w = MAX(1, new_width); long dst_h = MAX(1, new_height); float dx = (float)gdImageSX(im) / (float)dst_w; float dy = (float)gdImageSY(im) / (float)dst_h; gdFixed f_dx = gd_ftofx(dx); gdFix...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,158
gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height) { const unsigned long new_width = MAX(1, width); const unsigned long new_height = MAX(1, height); const float dx = (float)im->sx / (float)new_width; const float dy = (float)im->sy / (float)new_height; const gdFixed f_d...
DoS
0
gdImageScaleNearestNeighbour(gdImagePtr im, const unsigned int width, const unsigned int height) { const unsigned long new_width = MAX(1, width); const unsigned long new_height = MAX(1, height); const float dx = (float)im->sx / (float)new_width; const float dy = (float)im->sy / (float)new_height; const gdFixed f_d...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,159
BGD_DECLARE(int) gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id) { if (im == NULL || id < 0 || id > GD_METHOD_COUNT) { return 0; } switch (id) { case GD_DEFAULT: id = GD_BILINEAR_FIXED; /* Optimized versions */ case GD_BILINEAR_FIXED: case GD_BICUBIC_FIXED: case GD_NEAREST_NEIG...
DoS
0
BGD_DECLARE(int) gdImageSetInterpolationMethod(gdImagePtr im, gdInterpolationMethod id) { if (im == NULL || id < 0 || id > GD_METHOD_COUNT) { return 0; } switch (id) { case GD_DEFAULT: id = GD_BILINEAR_FIXED; /* Optimized versions */ case GD_BILINEAR_FIXED: case GD_BICUBIC_FIXED: case GD_NEAREST_NEIG...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,160
BGD_DECLARE(int) gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox) { gdPointF extent[4], min, max, point; int i; extent[0].x=0.0; extent[0].y=0.0; extent[1].x=(double) src->width; extent[1].y=0.0; extent[2].x=(double) src->width; extent[2].y=(double) src->height; extent[3].x=...
DoS
0
BGD_DECLARE(int) gdTransformAffineBoundingBox(gdRectPtr src, const double affine[6], gdRectPtr bbox) { gdPointF extent[4], min, max, point; int i; extent[0].x=0.0; extent[0].y=0.0; extent[1].x=(double) src->width; extent[1].y=0.0; extent[2].x=(double) src->width; extent[2].y=(double) src->height; extent[3].x=...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,161
BGD_DECLARE(int) gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6]) { int c1x,c1y,c2x,c2y; int backclip = 0; int backup_clipx1, backup_clipy1, backup_clipx2, backup_clipy2; register int x, y, src_offset_x, src_offset_y; do...
DoS
0
BGD_DECLARE(int) gdTransformAffineCopy(gdImagePtr dst, int dst_x, int dst_y, const gdImagePtr src, gdRectPtr src_region, const double affine[6]) { int c1x,c1y,c2x,c2y; int backclip = 0; int backup_clipx1, backup_clipy1, backup_clipx2, backup_clipy2; register int x, y, src_offset_x, src_offset_y; do...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,162
BGD_DECLARE(int) gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]) { int res; double m[6]; gdRect bbox; gdRect area_full; if (src_area == NULL) { area_full.x = 0; area_full.y = 0; area_full.width = gdImageSX(src); area_full.height = g...
DoS
0
BGD_DECLARE(int) gdTransformAffineGetImage(gdImagePtr *dst, const gdImagePtr src, gdRectPtr src_area, const double affine[6]) { int res; double m[6]; gdRect bbox; gdRect area_full; if (src_area == NULL) { area_full.x = 0; area_full.y = 0; area_full.width = gdImageSX(src); area_full.height = g...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,163
static int getPixelInterpolateWeight(gdImagePtr im, const double x, const double y, const int bgColor) { /* Closest pixel <= (xf,yf) */ int sx = (int)(x); int sy = (int)(y); const double xf = x - (double)sx; const double yf = y - (double)sy; const double nxf = (double) 1.0 - xf; const double nyf = (double) 1.0 -...
DoS
0
static int getPixelInterpolateWeight(gdImagePtr im, const double x, const double y, const int bgColor) { /* Closest pixel <= (xf,yf) */ int sx = (int)(x); int sy = (int)(y); const double xf = x - (double)sx; const double yf = y - (double)sy; const double nxf = (double) 1.0 - xf; const double nyf = (double) 1.0 -...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,164
int getPixelInterpolated(gdImagePtr im, const double x, const double y, const int bgColor) { const int xi=(int)((x) < 0 ? x - 1: x); const int yi=(int)((y) < 0 ? y - 1: y); int yii; int i; double kernel, kernel_cache_y; double kernel_x[12], kernel_y[4]; double new_r = 0.0f, new_g = 0.0f, new_b = 0.0f, new_a = 0....
DoS
0
int getPixelInterpolated(gdImagePtr im, const double x, const double y, const int bgColor) { const int xi=(int)((x) < 0 ? x - 1: x); const int yi=(int)((y) < 0 ? y - 1: y); int yii; int i; double kernel, kernel_cache_y; double kernel_x[12], kernel_y[4]; double new_r = 0.0f, new_g = 0.0f, new_b = 0.0f, new_a = 0....
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,165
static inline int getPixelOverflowColorTC(gdImagePtr im, const int x, const int y, const int color) { if (gdImageBoundsSafe(im, x, y)) { const int c = im->tpixels[y][x]; if (c == im->transparent) { return gdTrueColorAlpha(0, 0, 0, 127); } return c; } else { register int border = 0; if (y < im->cy1) { ...
DoS
0
static inline int getPixelOverflowColorTC(gdImagePtr im, const int x, const int y, const int color) { if (gdImageBoundsSafe(im, x, y)) { const int c = im->tpixels[y][x]; if (c == im->transparent) { return gdTrueColorAlpha(0, 0, 0, 127); } return c; } else { register int border = 0; if (y < im->cy1) { ...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,166
static inline int getPixelOverflowPalette(gdImagePtr im, const int x, const int y, const int bgColor) { if (gdImageBoundsSafe(im, x, y)) { const int c = im->pixels[y][x]; if (c == im->transparent) { return bgColor == -1 ? gdTrueColorAlpha(0, 0, 0, 127) : bgColor; } return colorIndex2RGBA(c); } else { reg...
DoS
0
static inline int getPixelOverflowPalette(gdImagePtr im, const int x, const int y, const int bgColor) { if (gdImageBoundsSafe(im, x, y)) { const int c = im->pixels[y][x]; if (c == im->transparent) { return bgColor == -1 ? gdTrueColorAlpha(0, 0, 0, 127) : bgColor; } return colorIndex2RGBA(c); } else { reg...
@@ -1087,7 +1087,7 @@ gdImageScaleTwoPass(const gdImagePtr src, const unsigned int new_width, }/* if */ if (src != tmp_im) { - gdFree(tmp_im); + gdImageDestroy(tmp_im); }/* if */ return dst;
CWE-399
null
null
45,167
int bad_cluster(DOS_FS * fs, uint32_t cluster) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, cluster, fs); return FAT_IS_BAD(fs, curEntry.value); }
DoS
0
int bad_cluster(DOS_FS * fs, uint32_t cluster) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, cluster, fs); return FAT_IS_BAD(fs, curEntry.value); }
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,168
loff_t cluster_start(DOS_FS * fs, uint32_t cluster) { return fs->data_start + ((loff_t) cluster - 2) * (uint64_t)fs->cluster_size; }
DoS
0
loff_t cluster_start(DOS_FS * fs, uint32_t cluster) { return fs->data_start + ((loff_t) cluster - 2) * (uint64_t)fs->cluster_size; }
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,169
void get_fat(FAT_ENTRY * entry, void *fat, uint32_t cluster, DOS_FS * fs) { unsigned char *ptr; switch (fs->fat_bits) { case 12: ptr = &((unsigned char *)fat)[cluster * 3 / 2]; entry->value = 0xfff & (cluster & 1 ? (ptr[0] >> 4) | (ptr[1] << 4) : (ptr[0] | ptr[1] << 8)); break; case 16: entry->...
DoS
0
void get_fat(FAT_ENTRY * entry, void *fat, uint32_t cluster, DOS_FS * fs) { unsigned char *ptr; switch (fs->fat_bits) { case 12: ptr = &((unsigned char *)fat)[cluster * 3 / 2]; entry->value = 0xfff & (cluster & 1 ? (ptr[0] >> 4) | (ptr[1] << 4) : (ptr[0] | ptr[1] << 8)); break; case 16: entry->...
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,170
DOS_FILE *get_owner(DOS_FS * fs, uint32_t cluster) { if (fs->cluster_owner == NULL) return NULL; else return fs->cluster_owner[cluster]; }
DoS
0
DOS_FILE *get_owner(DOS_FS * fs, uint32_t cluster) { if (fs->cluster_owner == NULL) return NULL; else return fs->cluster_owner[cluster]; }
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,171
uint32_t next_cluster(DOS_FS * fs, uint32_t cluster) { uint32_t value; FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, cluster, fs); value = curEntry.value; if (FAT_IS_BAD(fs, value)) die("Internal error: next_cluster on bad cluster"); return FAT_IS_EOF(fs, value) ? -1 : value; }
DoS
0
uint32_t next_cluster(DOS_FS * fs, uint32_t cluster) { uint32_t value; FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, cluster, fs); value = curEntry.value; if (FAT_IS_BAD(fs, value)) die("Internal error: next_cluster on bad cluster"); return FAT_IS_EOF(fs, value) ? -1 : value; }
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,172
void read_fat(DOS_FS * fs) { int eff_size, alloc_size; uint32_t i; void *first, *second = NULL; int first_ok, second_ok; uint32_t total_num_clusters; /* Clean up from previous pass */ if (fs->fat) free(fs->fat); if (fs->cluster_owner) free(fs->cluster_owner); fs->fat = NULL; f...
DoS
0
void read_fat(DOS_FS * fs) { int eff_size, alloc_size; uint32_t i; void *first, *second = NULL; int first_ok, second_ok; uint32_t total_num_clusters; /* Clean up from previous pass */ if (fs->fat) free(fs->fat); if (fs->cluster_owner) free(fs->cluster_owner); fs->fat = NULL; f...
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,173
void reclaim_file(DOS_FS * fs) { DOS_FILE orphan; int reclaimed, files; int changed = 0; uint32_t i, next, walk; uint32_t *num_refs = NULL; /* Only for orphaned clusters */ uint32_t total_num_clusters; if (verbose) printf("Reclaiming unconnected clusters.\n"); total_num_clusters = fs-...
DoS
0
void reclaim_file(DOS_FS * fs) { DOS_FILE orphan; int reclaimed, files; int changed = 0; uint32_t i, next, walk; uint32_t *num_refs = NULL; /* Only for orphaned clusters */ uint32_t total_num_clusters; if (verbose) printf("Reclaiming unconnected clusters.\n"); total_num_clusters = fs-...
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,174
void reclaim_free(DOS_FS * fs) { int reclaimed; uint32_t i; if (verbose) printf("Checking for unused clusters.\n"); reclaimed = 0; for (i = 2; i < fs->clusters + 2; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); if (!get_owner(fs, i) && curEntry.value && !FAT_IS_BAD(fs, cu...
DoS
0
void reclaim_free(DOS_FS * fs) { int reclaimed; uint32_t i; if (verbose) printf("Checking for unused clusters.\n"); reclaimed = 0; for (i = 2; i < fs->clusters + 2; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); if (!get_owner(fs, i) && curEntry.value && !FAT_IS_BAD(fs, cu...
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,175
void set_owner(DOS_FS * fs, uint32_t cluster, DOS_FILE * owner) { if (fs->cluster_owner == NULL) die("Internal error: attempt to set owner in non-existent table"); if (owner && fs->cluster_owner[cluster] && (fs->cluster_owner[cluster] != owner)) die("Internal error: attempt to change file owner"); fs->c...
DoS
0
void set_owner(DOS_FS * fs, uint32_t cluster, DOS_FILE * owner) { if (fs->cluster_owner == NULL) die("Internal error: attempt to set owner in non-existent table"); if (owner && fs->cluster_owner[cluster] && (fs->cluster_owner[cluster] != owner)) die("Internal error: attempt to change file owner"); fs->c...
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,176
static void tag_free(DOS_FS * fs, DOS_FILE * owner, uint32_t *num_refs, uint32_t start_cluster) { int prev; uint32_t i, walk; if (start_cluster == 0) start_cluster = 2; for (i = start_cluster; i < fs->clusters + 2; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); /* If the cu...
DoS
0
static void tag_free(DOS_FS * fs, DOS_FILE * owner, uint32_t *num_refs, uint32_t start_cluster) { int prev; uint32_t i, walk; if (start_cluster == 0) start_cluster = 2; for (i = start_cluster; i < fs->clusters + 2; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); /* If the cu...
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,177
uint32_t update_free(DOS_FS * fs) { uint32_t i; uint32_t free = 0; int do_set = 0; for (i = 2; i < fs->clusters + 2; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); if (!get_owner(fs, i) && !FAT_IS_BAD(fs, curEntry.value)) ++free; } if (!fs->fsinfo_start) return free; ...
DoS
0
uint32_t update_free(DOS_FS * fs) { uint32_t i; uint32_t free = 0; int do_set = 0; for (i = 2; i < fs->clusters + 2; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); if (!get_owner(fs, i) && !FAT_IS_BAD(fs, curEntry.value)) ++free; } if (!fs->fsinfo_start) return free; ...
@@ -205,7 +205,7 @@ void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) data[1] = new >> 4; } else { FAT_ENTRY subseqEntry; - if (cluster != fs->clusters - 1) + if (cluster != fs->clusters + 1) get_fat(&subseqEntry, fs->fat, cluster + 1, fs); else subseqEntry.value = 0;
CWE-189
null
null
45,178
void j2k_destroy_cstr_index (opj_codestream_index_t *p_cstr_ind) { if (p_cstr_ind) { if (p_cstr_ind->marker) { opj_free(p_cstr_ind->marker); p_cstr_ind->marker = NULL; } if (p_cstr_ind->tile_index) { ...
null
0
void j2k_destroy_cstr_index (opj_codestream_index_t *p_cstr_ind) { if (p_cstr_ind) { if (p_cstr_ind->marker) { opj_free(p_cstr_ind->marker); p_cstr_ind->marker = NULL; } if (p_cstr_ind->tile_index) { ...
@@ -5559,8 +5559,7 @@ static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k, assert(p_stream != 00); l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]); - l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data; - + l_mco_size = 5 + l_tcp->m_nb_mcc_records; ...
CWE-416
null
null
45,179
void j2k_dump (opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream) { /* Check if the flag is compatible with j2k file*/ if ( (flag & OPJ_JP2_INFO) || (flag & OPJ_JP2_IND)){ fprintf(out_stream, "Wrong flag\n"); return; } /* Dump the image_header */ ...
null
0
void j2k_dump (opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream) { /* Check if the flag is compatible with j2k file*/ if ( (flag & OPJ_JP2_INFO) || (flag & OPJ_JP2_IND)){ fprintf(out_stream, "Wrong flag\n"); return; } /* Dump the image_header */ ...
@@ -5559,8 +5559,7 @@ static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k, assert(p_stream != 00); l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]); - l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data; - + l_mco_size = 5 + l_tcp->m_nb_mcc_records; ...
CWE-416
null
null
45,180
void j2k_dump_image_comp_header(opj_image_comp_t* comp_header, OPJ_BOOL dev_dump_flag, FILE* out_stream) { char tab[3]; if (dev_dump_flag){ fprintf(stdout, "[DEV] Dump an image_comp_header struct {\n"); tab[0] = '\0'; } else { tab[0] = '\t';...
null
0
void j2k_dump_image_comp_header(opj_image_comp_t* comp_header, OPJ_BOOL dev_dump_flag, FILE* out_stream) { char tab[3]; if (dev_dump_flag){ fprintf(stdout, "[DEV] Dump an image_comp_header struct {\n"); tab[0] = '\0'; } else { tab[0] = '\t';...
@@ -5559,8 +5559,7 @@ static OPJ_BOOL opj_j2k_write_mco( opj_j2k_t *p_j2k, assert(p_stream != 00); l_tcp =&(p_j2k->m_cp.tcps[p_j2k->m_current_tile_number]); - l_current_data = p_j2k->m_specific_param.m_encoder.m_header_tile_data; - + l_mco_size = 5 + l_tcp->m_nb_mcc_records; ...
CWE-416
null
null
45,181
checkdone(struct magic_set *ms, int *rv) { if ((ms->flags & MAGIC_CONTINUE) == 0) return 1; if (file_printf(ms, "\n- ") == -1) *rv = -1; return 0; }
DoS Exec Code Overflow
0
checkdone(struct magic_set *ms, int *rv) { if ((ms->flags & MAGIC_CONTINUE) == 0) return 1; if (file_printf(ms, "\n- ") == -1) *rv = -1; return 0; }
@@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.80 2015/01/02 21:29:39 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.81 2015/05/28 19:26:59 christos Exp $") #endif /* lint */ #include "magic.h" @@ -416,7 +416,7 @@ file_check_mem(struct magic_set *ms, unsigned int leve...
CWE-119
null
null
45,182
file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb) { char *rbuf; if (ms->event_flags & EVENT_HAD_ERR) { free(pb->buf); free(pb); return NULL; } rbuf = ms->o.buf; ms->o.buf = pb->buf; ms->offset = pb->offset; free(pb); return rbuf; }
DoS Exec Code Overflow
0
file_pop_buffer(struct magic_set *ms, file_pushbuf_t *pb) { char *rbuf; if (ms->event_flags & EVENT_HAD_ERR) { free(pb->buf); free(pb); return NULL; } rbuf = ms->o.buf; ms->o.buf = pb->buf; ms->offset = pb->offset; free(pb); return rbuf; }
@@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.80 2015/01/02 21:29:39 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.81 2015/05/28 19:26:59 christos Exp $") #endif /* lint */ #include "magic.h" @@ -416,7 +416,7 @@ file_check_mem(struct magic_set *ms, unsigned int leve...
CWE-119
null
null
45,183
file_push_buffer(struct magic_set *ms) { file_pushbuf_t *pb; if (ms->event_flags & EVENT_HAD_ERR) return NULL; if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL) return NULL; pb->buf = ms->o.buf; pb->offset = ms->offset; ms->o.buf = NULL; ms->offset = 0; return pb; }
DoS Exec Code Overflow
0
file_push_buffer(struct magic_set *ms) { file_pushbuf_t *pb; if (ms->event_flags & EVENT_HAD_ERR) return NULL; if ((pb = (CAST(file_pushbuf_t *, malloc(sizeof(*pb))))) == NULL) return NULL; pb->buf = ms->o.buf; pb->offset = ms->offset; ms->o.buf = NULL; ms->offset = 0; return pb; }
@@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.80 2015/01/02 21:29:39 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.81 2015/05/28 19:26:59 christos Exp $") #endif /* lint */ #include "magic.h" @@ -416,7 +416,7 @@ file_check_mem(struct magic_set *ms, unsigned int leve...
CWE-119
null
null
45,184
file_regerror(file_regex_t *rx, int rc, struct magic_set *ms) { char errmsg[512]; (void)regerror(rc, &rx->rx, errmsg, sizeof(errmsg)); file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat, errmsg); }
DoS Exec Code Overflow
0
file_regerror(file_regex_t *rx, int rc, struct magic_set *ms) { char errmsg[512]; (void)regerror(rc, &rx->rx, errmsg, sizeof(errmsg)); file_magerror(ms, "regex error %d for `%s', (%s)", rc, rx->pat, errmsg); }
@@ -27,7 +27,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.80 2015/01/02 21:29:39 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.81 2015/05/28 19:26:59 christos Exp $") #endif /* lint */ #include "magic.h" @@ -416,7 +416,7 @@ file_check_mem(struct magic_set *ms, unsigned int leve...
CWE-119
null
null
45,185
static chclass classify(char c) { switch (c) { case ' ': case '\t': case '\r': case '\n': return WHITESPACE; case '"': return QUOTE; case '[': case ',': case ']': case '{': case ':': case '}': return STRUCTURE; default: return LITERAL; } }
DoS Overflow
0
static chclass classify(char c) { switch (c) { case ' ': case '\t': case '\r': case '\n': return WHITESPACE; case '"': return QUOTE; case '[': case ',': case ']': case '{': case ':': case '}': return STRUCTURE; default: return LITERAL; } }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,186
static pfunc found_string(struct jv_parser* p) { char* in = p->tokenbuf; char* out = p->tokenbuf; char* end = p->tokenbuf + p->tokenpos; while (in < end) { char c = *in++; if (c == '\\') { if (in >= end) return "Expected escape character at end of string"; c = *in++; switch (c...
DoS Overflow
0
static pfunc found_string(struct jv_parser* p) { char* in = p->tokenbuf; char* out = p->tokenbuf; char* end = p->tokenbuf + p->tokenpos; while (in < end) { char c = *in++; if (c == '\\') { if (in >= end) return "Expected escape character at end of string"; c = *in++; switch (c...
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,187
jv jv_parse(const char* string) { return jv_parse_sized(string, strlen(string)); }
DoS Overflow
0
jv jv_parse(const char* string) { return jv_parse_sized(string, strlen(string)); }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,188
void jv_parser_free(struct jv_parser* p) { parser_free(p); jv_mem_free(p); }
DoS Overflow
0
void jv_parser_free(struct jv_parser* p) { parser_free(p); jv_mem_free(p); }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,189
struct jv_parser* jv_parser_new(int flags) { struct jv_parser* p = jv_mem_alloc(sizeof(struct jv_parser)); parser_init(p, flags); p->flags = flags; return p; }
DoS Overflow
0
struct jv_parser* jv_parser_new(int flags) { struct jv_parser* p = jv_mem_alloc(sizeof(struct jv_parser)); parser_init(p, flags); p->flags = flags; return p; }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,190
jv jv_parser_next(struct jv_parser* p) { if (p->eof) return jv_invalid(); if (!p->curr_buf) return jv_invalid(); // Need a buffer if (p->bom_strip_position == 0xff) { if (!(p->flags & JV_PARSE_SEQ)) return jv_invalid_with_msg(jv_string("Malformed BOM")); p->st =JV_PARSER_WAITING_FOR_RS; ...
DoS Overflow
0
jv jv_parser_next(struct jv_parser* p) { if (p->eof) return jv_invalid(); if (!p->curr_buf) return jv_invalid(); // Need a buffer if (p->bom_strip_position == 0xff) { if (!(p->flags & JV_PARSE_SEQ)) return jv_invalid_with_msg(jv_string("Malformed BOM")); p->st =JV_PARSER_WAITING_FOR_RS; ...
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,191
static jv make_error(struct jv_parser* p, const char *fmt, ...) { va_list ap; va_start(ap, fmt); jv e = jv_string_vfmt(fmt, ap); va_end(ap); if ((p->flags & JV_PARSE_STREAM_ERRORS)) return JV_ARRAY(e, jv_copy(p->path)); return jv_invalid_with_msg(e); }
DoS Overflow
0
static jv make_error(struct jv_parser* p, const char *fmt, ...) { va_list ap; va_start(ap, fmt); jv e = jv_string_vfmt(fmt, ap); va_end(ap); if ((p->flags & JV_PARSE_STREAM_ERRORS)) return JV_ARRAY(e, jv_copy(p->path)); return jv_invalid_with_msg(e); }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,192
static int parse_check_done(struct jv_parser* p, jv* out) { if (p->stackpos == 0 && jv_is_valid(p->next)) { *out = p->next; p->next = jv_invalid(); return 1; } else { return 0; } }
DoS Overflow
0
static int parse_check_done(struct jv_parser* p, jv* out) { if (p->stackpos == 0 && jv_is_valid(p->next)) { *out = p->next; p->next = jv_invalid(); return 1; } else { return 0; } }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,193
static int parse_check_truncation(struct jv_parser* p) { return ((p->flags & JV_PARSE_SEQ) && !p->last_ch_was_ws && (p->stackpos > 0 || p->tokenpos > 0 || jv_get_kind(p->next) == JV_KIND_NUMBER)); }
DoS Overflow
0
static int parse_check_truncation(struct jv_parser* p) { return ((p->flags & JV_PARSE_SEQ) && !p->last_ch_was_ws && (p->stackpos > 0 || p->tokenpos > 0 || jv_get_kind(p->next) == JV_KIND_NUMBER)); }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,194
static int parse_is_top_num(struct jv_parser* p) { return (p->stackpos == 0 && jv_get_kind(p->next) == JV_KIND_NUMBER); }
DoS Overflow
0
static int parse_is_top_num(struct jv_parser* p) { return (p->stackpos == 0 && jv_get_kind(p->next) == JV_KIND_NUMBER); }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,195
static pfunc parse_token(struct jv_parser* p, char ch) { switch (ch) { case '[': if (jv_is_valid(p->next)) return "Expected separator between values"; push(p, jv_array()); break; case '{': if (jv_is_valid(p->next)) return "Expected separator between values"; push(p, jv_object()); break; ...
DoS Overflow
0
static pfunc parse_token(struct jv_parser* p, char ch) { switch (ch) { case '[': if (jv_is_valid(p->next)) return "Expected separator between values"; push(p, jv_array()); break; case '{': if (jv_is_valid(p->next)) return "Expected separator between values"; push(p, jv_object()); break; ...
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,196
static void parser_free(struct jv_parser* p) { parser_reset(p); jv_free(p->path); jv_free(p->output); jv_mem_free(p->stack); jv_mem_free(p->tokenbuf); jvp_dtoa_context_free(&p->dtoa); }
DoS Overflow
0
static void parser_free(struct jv_parser* p) { parser_reset(p); jv_free(p->path); jv_free(p->output); jv_mem_free(p->stack); jv_mem_free(p->tokenbuf); jvp_dtoa_context_free(&p->dtoa); }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,197
static void parser_init(struct jv_parser* p, int flags) { p->flags = flags; if ((p->flags & JV_PARSE_STREAMING)) { p->path = jv_array(); } else { p->path = jv_invalid(); p->flags &= ~(JV_PARSE_STREAM_ERRORS); } p->stack = 0; p->stacklen = p->stackpos = 0; p->last_seen = JV_LAST_NONE; p->outp...
DoS Overflow
0
static void parser_init(struct jv_parser* p, int flags) { p->flags = flags; if ((p->flags & JV_PARSE_STREAMING)) { p->path = jv_array(); } else { p->path = jv_invalid(); p->flags &= ~(JV_PARSE_STREAM_ERRORS); } p->stack = 0; p->stacklen = p->stackpos = 0; p->last_seen = JV_LAST_NONE; p->outp...
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,198
static void push(struct jv_parser* p, jv v) { assert(p->stackpos <= p->stacklen); if (p->stackpos == p->stacklen) { p->stacklen = p->stacklen * 2 + 10; p->stack = jv_mem_realloc(p->stack, p->stacklen * sizeof(jv)); } assert(p->stackpos < p->stacklen); p->stack[p->stackpos++] = v; }
DoS Overflow
0
static void push(struct jv_parser* p, jv v) { assert(p->stackpos <= p->stacklen); if (p->stackpos == p->stacklen) { p->stacklen = p->stacklen * 2 + 10; p->stack = jv_mem_realloc(p->stack, p->stacklen * sizeof(jv)); } assert(p->stackpos < p->stacklen); p->stack[p->stackpos++] = v; }
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null
45,199
static pfunc scan(struct jv_parser* p, char ch, jv* out) { p->column++; if (ch == '\n') { p->line++; p->column = 0; } if (ch == '\036' /* ASCII RS; see draft-ietf-json-sequence-07 */) { if (check_truncation(p)) { if (check_literal(p) == 0 && is_top_num(p)) return "Potentially truncated...
DoS Overflow
0
static pfunc scan(struct jv_parser* p, char ch, jv* out) { p->column++; if (ch == '\n') { p->line++; p->column = 0; } if (ch == '\036' /* ASCII RS; see draft-ietf-json-sequence-07 */) { if (check_truncation(p)) { if (check_literal(p) == 0 && is_top_num(p)) return "Potentially truncated...
@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { static void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); - if (p->tokenpos == p->tokenlen) { + if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_re...
CWE-119
null
null