idx int64 | func_before string | Vulnerability Classification string | vul int64 | func_after string | patch string | CWE ID string | lines_before string | lines_after string |
|---|---|---|---|---|---|---|---|---|
43,600 | static PHP_NAMED_FUNCTION(zif_zip_entry_close)
{
zval * zip_entry;
zip_read_rsrc * zr_rsrc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zip_entry) == FAILURE) {
return;
}
if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_entry)) == NULL) {
RETURN_FALSE;
}... | DoS Overflow | 0 | static PHP_NAMED_FUNCTION(zif_zip_entry_close)
{
zval * zip_entry;
zip_read_rsrc * zr_rsrc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zip_entry) == FAILURE) {
return;
}
if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_entry)) == NULL) {
RETURN_FALSE;
}... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,601 | static ZIPARCHIVE_METHOD(open)
{
struct zip *intern;
int err = 0;
zend_long flags = 0;
char *resolved_path;
zend_string *filename;
zval *self = getThis();
ze_zip_object *ze_obj = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &filename, &flags) == FAILURE) {
return;
}
if (self) {
/* We do not u... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(open)
{
struct zip *intern;
int err = 0;
zend_long flags = 0;
char *resolved_path;
zend_string *filename;
zval *self = getThis();
ze_zip_object *ze_obj = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &filename, &flags) == FAILURE) {
return;
}
if (self) {
/* We do not u... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,602 | static ZIPARCHIVE_METHOD(setPassword)
{
struct zip *intern;
zval *self = getThis();
char *password;
size_t password_len;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &password, &password_len) == FAILURE) {
return;
}
if (password_len < 1) {... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(setPassword)
{
struct zip *intern;
zval *self = getThis();
char *password;
size_t password_len;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &password, &password_len) == FAILURE) {
return;
}
if (password_len < 1) {... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,603 | static ZIPARCHIVE_METHOD(close)
{
struct zip *intern;
zval *self = getThis();
ze_zip_object *ze_obj;
int err;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
ze_obj = Z_ZIP_P(self);
if ((err = zip_close(intern))) {
php_error_docref(NULL, E_WARNING, "%s", zip_strerror(intern));
zip_discard... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(close)
{
struct zip *intern;
zval *self = getThis();
ze_zip_object *ze_obj;
int err;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
ze_obj = Z_ZIP_P(self);
if ((err = zip_close(intern))) {
php_error_docref(NULL, E_WARNING, "%s", zip_strerror(intern));
zip_discard... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,604 | static ZIPARCHIVE_METHOD(getStatusString)
{
struct zip *intern;
zval *self = getThis();
#if LIBZIP_VERSION_MAJOR < 1
int zep, syp, len;
char error_string[128];
#else
zip_error_t *err;
#endif
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
#if LIBZIP_VERSION_MAJOR < 1
zip_error_get(intern, &zep... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(getStatusString)
{
struct zip *intern;
zval *self = getThis();
#if LIBZIP_VERSION_MAJOR < 1
int zep, syp, len;
char error_string[128];
#else
zip_error_t *err;
#endif
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
#if LIBZIP_VERSION_MAJOR < 1
zip_error_get(intern, &zep... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,605 | static ZIPARCHIVE_METHOD(addEmptyDir)
{
struct zip *intern;
zval *self = getThis();
char *dirname;
size_t dirname_len;
int idx;
struct zip_stat sb;
char *s;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&dirname, &dirname_len) == FAILUR... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(addEmptyDir)
{
struct zip *intern;
zval *self = getThis();
char *dirname;
size_t dirname_len;
int idx;
struct zip_stat sb;
char *s;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&dirname, &dirname_len) == FAILUR... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,606 | static ZIPARCHIVE_METHOD(addFromString)
{
struct zip *intern;
zval *self = getThis();
zend_string *buffer;
char *name;
size_t name_len;
ze_zip_object *ze_obj;
struct zip_source *zs;
int pos = 0;
int cur_idx;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(addFromString)
{
struct zip *intern;
zval *self = getThis();
zend_string *buffer;
char *name;
size_t name_len;
ze_zip_object *ze_obj;
struct zip_source *zs;
int pos = 0;
int cur_idx;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,607 | static ZIPARCHIVE_METHOD(statName)
{
struct zip *intern;
zval *self = getThis();
zend_long flags = 0;
struct zip_stat sb;
zend_string *name;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &name, &flags) == FAILURE) {
return;
}
PHP_ZIP_STA... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(statName)
{
struct zip *intern;
zval *self = getThis();
zend_long flags = 0;
struct zip_stat sb;
zend_string *name;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &name, &flags) == FAILURE) {
return;
}
PHP_ZIP_STA... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,608 | static ZIPARCHIVE_METHOD(statIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index, flags = 0;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &flags) == FAILURE) {
return;
}
if (zip_stat_index... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(statIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index, flags = 0;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &flags) == FAILURE) {
return;
}
if (zip_stat_index... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,609 | static ZIPARCHIVE_METHOD(locateName)
{
struct zip *intern;
zval *self = getThis();
zend_long flags = 0;
zend_long idx = -1;
zend_string *name;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &name, &flags) == FAILURE) {
return;
}
if (ZSTR_... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(locateName)
{
struct zip *intern;
zval *self = getThis();
zend_long flags = 0;
zend_long idx = -1;
zend_string *name;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P|l", &name, &flags) == FAILURE) {
return;
}
if (ZSTR_... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,610 | static ZIPARCHIVE_METHOD(getNameIndex)
{
struct zip *intern;
zval *self = getThis();
const char *name;
zend_long flags = 0, index = 0;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &flags) == FAILURE) {
return;
}
name = zip_get... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(getNameIndex)
{
struct zip *intern;
zval *self = getThis();
const char *name;
zend_long flags = 0, index = 0;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &flags) == FAILURE) {
return;
}
name = zip_get... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,611 | static ZIPARCHIVE_METHOD(setArchiveComment)
{
struct zip *intern;
zval *self = getThis();
size_t comment_len;
char * comment;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &comment, &comment_len) == FAILURE) {
return;
}
if (zip_set_archive_c... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(setArchiveComment)
{
struct zip *intern;
zval *self = getThis();
size_t comment_len;
char * comment;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &comment, &comment_len) == FAILURE) {
return;
}
if (zip_set_archive_c... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,612 | static ZIPARCHIVE_METHOD(getArchiveComment)
{
struct zip *intern;
zval *self = getThis();
zend_long flags = 0;
const char * comment;
int comment_len = 0;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) {
return;
}
commen... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(getArchiveComment)
{
struct zip *intern;
zval *self = getThis();
zend_long flags = 0;
const char * comment;
int comment_len = 0;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &flags) == FAILURE) {
return;
}
commen... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,613 | static ZIPARCHIVE_METHOD(setExternalAttributesName)
{
struct zip *intern;
zval *self = getThis();
size_t name_len;
char *name;
zend_long flags=0, opsys, attr;
zip_int64_t idx;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll|l",
&name, &name_l... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(setExternalAttributesName)
{
struct zip *intern;
zval *self = getThis();
size_t name_len;
char *name;
zend_long flags=0, opsys, attr;
zip_int64_t idx;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sll|l",
&name, &name_l... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,614 | static ZIPARCHIVE_METHOD(setExternalAttributesIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index, flags=0, opsys, attr;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll|l",
&index, &opsys, &attr, &flags) == ... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(setExternalAttributesIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index, flags=0, opsys, attr;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll|l",
&index, &opsys, &attr, &flags) == ... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,615 | static ZIPARCHIVE_METHOD(getExternalAttributesName)
{
struct zip *intern;
zval *self = getThis(), *z_opsys, *z_attr;
size_t name_len;
char *name;
zend_long flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
zip_int64_t idx;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_paramete... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(getExternalAttributesName)
{
struct zip *intern;
zval *self = getThis(), *z_opsys, *z_attr;
size_t name_len;
char *name;
zend_long flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
zip_int64_t idx;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_paramete... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,616 | static ZIPARCHIVE_METHOD(getExternalAttributesIndex)
{
struct zip *intern;
zval *self = getThis(), *z_opsys, *z_attr;
zend_long index, flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), ... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(getExternalAttributesIndex)
{
struct zip *intern;
zval *self = getThis(), *z_opsys, *z_attr;
zend_long index, flags=0;
zip_uint8_t opsys;
zip_uint32_t attr;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), ... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,617 | static ZIPARCHIVE_METHOD(getCommentName)
{
struct zip *intern;
zval *self = getThis();
size_t name_len;
int idx;
zend_long flags = 0;
int comment_len = 0;
const char * comment;
char *name;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
&... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(getCommentName)
{
struct zip *intern;
zval *self = getThis();
size_t name_len;
int idx;
zend_long flags = 0;
int comment_len = 0;
const char * comment;
char *name;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|l",
&... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,618 | static ZIPARCHIVE_METHOD(getCommentIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index, flags = 0;
const char * comment;
int comment_len = 0;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &fla... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(getCommentIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index, flags = 0;
const char * comment;
int comment_len = 0;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|l",
&index, &fla... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,619 | static ZIPARCHIVE_METHOD(setCompressionName)
{
struct zip *intern;
zval *this = getThis();
size_t name_len;
char *name;
zip_int64_t idx;
zend_long comp_method, comp_flags = 0;
if (!this) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, this);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l",
&name, &name_l... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(setCompressionName)
{
struct zip *intern;
zval *this = getThis();
size_t name_len;
char *name;
zip_int64_t idx;
zend_long comp_method, comp_flags = 0;
if (!this) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, this);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l",
&name, &name_l... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,620 | static ZIPARCHIVE_METHOD(deleteIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
return;
}
if (index < 0) {
RETURN_FALSE;
}
if (zip_delete(intern, i... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(deleteIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
return;
}
if (index < 0) {
RETURN_FALSE;
}
if (zip_delete(intern, i... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,621 | static ZIPARCHIVE_METHOD(deleteName)
{
struct zip *intern;
zval *self = getThis();
size_t name_len;
char *name;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
if (name_len < 1) {
... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(deleteName)
{
struct zip *intern;
zval *self = getThis();
size_t name_len;
char *name;
struct zip_stat sb;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
if (name_len < 1) {
... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,622 | static ZIPARCHIVE_METHOD(renameIndex)
{
struct zip *intern;
zval *self = getThis();
char *new_name;
size_t new_name_len;
zend_long index;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &index, &new_name, &new_name_len) == FAILURE) {
return;
... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(renameIndex)
{
struct zip *intern;
zval *self = getThis();
char *new_name;
size_t new_name_len;
zend_long index;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ls", &index, &new_name, &new_name_len) == FAILURE) {
return;
... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,623 | static ZIPARCHIVE_METHOD(renameName)
{
struct zip *intern;
zval *self = getThis();
struct zip_stat sb;
char *name, *new_name;
size_t name_len, new_name_len;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &new_name, &new_name_l... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(renameName)
{
struct zip *intern;
zval *self = getThis();
struct zip_stat sb;
char *name, *new_name;
size_t name_len, new_name_len;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &name, &name_len, &new_name, &new_name_l... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,624 | static ZIPARCHIVE_METHOD(unchangeIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
return;
}
if (index < 0) {
RETURN_FALSE;
}
if (zip_unchange(inter... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(unchangeIndex)
{
struct zip *intern;
zval *self = getThis();
zend_long index;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) {
return;
}
if (index < 0) {
RETURN_FALSE;
}
if (zip_unchange(inter... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,625 | static ZIPARCHIVE_METHOD(unchangeName)
{
struct zip *intern;
zval *self = getThis();
struct zip_stat sb;
char *name;
size_t name_len;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
if (name_len < 1)... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(unchangeName)
{
struct zip *intern;
zval *self = getThis();
struct zip_stat sb;
char *name;
size_t name_len;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &name, &name_len) == FAILURE) {
return;
}
if (name_len < 1)... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,626 | static ZIPARCHIVE_METHOD(unchangeAll)
{
struct zip *intern;
zval *self = getThis();
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zip_unchange_all(intern) != 0) {
RETURN_FALSE;
} else {
RETURN_TRUE;
}
}
| DoS Overflow | 0 | static ZIPARCHIVE_METHOD(unchangeAll)
{
struct zip *intern;
zval *self = getThis();
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zip_unchange_all(intern) != 0) {
RETURN_FALSE;
} else {
RETURN_TRUE;
}
}
| @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,627 | static ZIPARCHIVE_METHOD(unchangeArchive)
{
struct zip *intern;
zval *self = getThis();
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zip_unchange_archive(intern) != 0) {
RETURN_FALSE;
} else {
RETURN_TRUE;
}
}
| DoS Overflow | 0 | static ZIPARCHIVE_METHOD(unchangeArchive)
{
struct zip *intern;
zval *self = getThis();
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zip_unchange_archive(intern) != 0) {
RETURN_FALSE;
} else {
RETURN_TRUE;
}
}
| @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,628 | static ZIPARCHIVE_METHOD(extractTo)
{
struct zip *intern;
zval *self = getThis();
zval *zval_files = NULL;
zval *zval_file = NULL;
php_stream_statbuf ssb;
char *pathto;
size_t pathto_len;
int ret, i;
int nelems;
if (!self) {
RETURN_FALSE;
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &pathto, &p... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(extractTo)
{
struct zip *intern;
zval *self = getThis();
zval *zval_files = NULL;
zval *zval_file = NULL;
php_stream_statbuf ssb;
char *pathto;
size_t pathto_len;
int ret, i;
int nelems;
if (!self) {
RETURN_FALSE;
}
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z", &pathto, &p... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,629 | static ZIPARCHIVE_METHOD(getStream)
{
struct zip *intern;
zval *self = getThis();
struct zip_stat sb;
char *mode = "rb";
zend_string *filename;
php_stream *stream;
ze_zip_object *obj;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &filename) =... | DoS Overflow | 0 | static ZIPARCHIVE_METHOD(getStream)
{
struct zip *intern;
zval *self = getThis();
struct zip_stat sb;
char *mode = "rb";
zend_string *filename;
php_stream *stream;
ze_zip_object *obj;
if (!self) {
RETURN_FALSE;
}
ZIP_FROM_OBJECT(intern, self);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "P", &filename) =... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,630 | static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
{
struct zip *intern;
zval *self = getThis();
char *path = NULL;
char *remove_path = NULL;
char *add_path = NULL;
size_t add_path_len, remove_path_len = 0, path_len = 0;
zend_long remove_all_path = 0;
zend_long flags = 0;
z... | DoS Overflow | 0 | static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */
{
struct zip *intern;
zval *self = getThis();
char *path = NULL;
char *remove_path = NULL;
char *add_path = NULL;
size_t add_path_len, remove_path_len = 0, path_len = 0;
zend_long remove_all_path = 0;
zend_long flags = 0;
z... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,631 | static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ */
{
zval * zip_entry;
zip_read_rsrc * zr_rsrc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zip_entry) == FAILURE) {
return;
}
if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_... | DoS Overflow | 0 | static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ */
{
zval * zip_entry;
zip_read_rsrc * zr_rsrc;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zip_entry) == FAILURE) {
return;
}
if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,632 | static int php_zip_extract_file(struct zip * za, char *dest, char *file, int file_len)
{
php_stream_statbuf ssb;
struct zip_file *zf;
struct zip_stat sb;
char b[8192];
int n, len, ret;
php_stream *stream;
char *fullpath;
char *file_dirname_fullpath;
char file_dirname[MAXPATHLEN];
size_t dir_len;
int is_dir_o... | DoS Overflow | 0 | static int php_zip_extract_file(struct zip * za, char *dest, char *file, int file_len)
{
php_stream_statbuf ssb;
struct zip_file *zf;
struct zip_stat sb;
char b[8192];
int n, len, ret;
php_stream *stream;
char *fullpath;
char *file_dirname_fullpath;
char file_dirname[MAXPATHLEN];
size_t dir_len;
int is_dir_o... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,633 | static void php_zip_free_dir(zend_resource *rsrc)
{
zip_rsrc * zip_int = (zip_rsrc *) rsrc->ptr;
if (zip_int) {
if (zip_int->za) {
if (zip_close(zip_int->za) != 0) {
php_error_docref(NULL, E_WARNING, "Cannot destroy the zip context");
}
zip_int->za = NULL;
}
efree(rsrc->ptr);
rsrc->ptr = NULL;... | DoS Overflow | 0 | static void php_zip_free_dir(zend_resource *rsrc)
{
zip_rsrc * zip_int = (zip_rsrc *) rsrc->ptr;
if (zip_int) {
if (zip_int->za) {
if (zip_close(zip_int->za) != 0) {
php_error_docref(NULL, E_WARNING, "Cannot destroy the zip context");
}
zip_int->za = NULL;
}
efree(rsrc->ptr);
rsrc->ptr = NULL;... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,634 | static void php_zip_free_entry(zend_resource *rsrc)
{
zip_read_rsrc *zr_rsrc = (zip_read_rsrc *) rsrc->ptr;
if (zr_rsrc) {
if (zr_rsrc->zf) {
zip_fclose(zr_rsrc->zf);
zr_rsrc->zf = NULL;
}
efree(zr_rsrc);
rsrc->ptr = NULL;
}
}
| DoS Overflow | 0 | static void php_zip_free_entry(zend_resource *rsrc)
{
zip_read_rsrc *zr_rsrc = (zip_read_rsrc *) rsrc->ptr;
if (zr_rsrc) {
if (zr_rsrc->zf) {
zip_fclose(zr_rsrc->zf);
zr_rsrc->zf = NULL;
}
efree(zr_rsrc);
rsrc->ptr = NULL;
}
}
| @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,635 | static void php_zip_free_prop_handler(zval *el) /* {{{ */ {
pefree(Z_PTR_P(el), 1);
} /* }}} */
| DoS Overflow | 0 | static void php_zip_free_prop_handler(zval *el) /* {{{ */ {
pefree(Z_PTR_P(el), 1);
} /* }}} */
| @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,636 | static HashTable *php_zip_get_properties(zval *object)/* {{{ */
{
ze_zip_object *obj;
HashTable *props;
zip_prop_handler *hnd;
zend_string *key;
obj = Z_ZIP_P(object);
props = zend_std_get_properties(object);
if (obj->prop_handler == NULL) {
return NULL;
}
ZEND_HASH_FOREACH_STR_KEY_PTR(obj->prop_handler, ... | DoS Overflow | 0 | static HashTable *php_zip_get_properties(zval *object)/* {{{ */
{
ze_zip_object *obj;
HashTable *props;
zip_prop_handler *hnd;
zend_string *key;
obj = Z_ZIP_P(object);
props = zend_std_get_properties(object);
if (obj->prop_handler == NULL) {
return NULL;
}
ZEND_HASH_FOREACH_STR_KEY_PTR(obj->prop_handler, ... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,637 | static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_COPY(&tmp_member, member);
convert_to... | DoS Overflow | 0 | static zval *php_zip_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_COPY(&tmp_member, member);
convert_to... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,638 | int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_value) /* {{{ */
{
#ifdef HAVE_GLOB
char cwd[MAXPATHLEN];
int cwd_skip = 0;
#ifdef ZTS
char work_pattern[MAXPATHLEN];
char *result;
#endif
glob_t globbuf;
int n;
int ret;
if (pattern_len >= MAXPATHLEN) {
php_error_docref(NULL, E_W... | DoS Overflow | 0 | int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_value) /* {{{ */
{
#ifdef HAVE_GLOB
char cwd[MAXPATHLEN];
int cwd_skip = 0;
#ifdef ZTS
char work_pattern[MAXPATHLEN];
char *result;
#endif
glob_t globbuf;
int n;
int ret;
if (pattern_len >= MAXPATHLEN) {
php_error_docref(NULL, E_W... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,639 | static int php_zip_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
zval tmp_member;
zip_prop_handler *hnd = NULL;
zend_object_handlers *std_hnd;
int retval = 0;
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_COPY(&tmp_member, member);
convert_to_string(&tmp_me... | DoS Overflow | 0 | static int php_zip_has_property(zval *object, zval *member, int type, void **cache_slot) /* {{{ */
{
ze_zip_object *obj;
zval tmp_member;
zip_prop_handler *hnd = NULL;
zend_object_handlers *std_hnd;
int retval = 0;
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_COPY(&tmp_member, member);
convert_to_string(&tmp_me... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,640 | static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
{
char *path_begin = path;
size_t i;
if (path_len < 1 || path == NULL) {
return NULL;
}
if (IS_SLASH(path[0])) {
return path + 1;
}
i = path_len;
while (1) {
while (i > 0 && !IS_SLASH(path[i])) {
i--;
}
if (!i) {
... | DoS Overflow | 0 | static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */
{
char *path_begin = path;
size_t i;
if (path_len < 1 || path == NULL) {
return NULL;
}
if (IS_SLASH(path[0])) {
return path + 1;
}
i = path_len;
while (1) {
while (i > 0 && !IS_SLASH(path[i])) {
i--;
}
if (!i) {
... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,641 | static zend_object *php_zip_object_new(zend_class_entry *class_type) /* {{{ */
{
ze_zip_object *intern;
intern = ecalloc(1, sizeof(ze_zip_object) + zend_object_properties_size(class_type));
intern->prop_handler = &zip_prop_handlers;
zend_object_std_init(&intern->zo, class_type);
object_properties_init(&intern->zo... | DoS Overflow | 0 | static zend_object *php_zip_object_new(zend_class_entry *class_type) /* {{{ */
{
ze_zip_object *intern;
intern = ecalloc(1, sizeof(ze_zip_object) + zend_object_properties_size(class_type));
intern->prop_handler = &zip_prop_handlers;
zend_object_std_init(&intern->zo, class_type);
object_properties_init(&intern->zo... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,642 | int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_value) /* {{{ */
{
#ifdef ZTS
char cwd[MAXPATHLEN];
int cwd_skip = 0;
char work_path[MAXPATHLEN];
char *result;
#endif
int files_cnt;
zend_string **namelist;
#ifdef ZTS
if (!IS_ABSOLUTE_PATH(path, path_len)) {
result = VCWD_GETCWD(cw... | DoS Overflow | 0 | int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_value) /* {{{ */
{
#ifdef ZTS
char cwd[MAXPATHLEN];
int cwd_skip = 0;
char work_path[MAXPATHLEN];
char *result;
#endif
int files_cnt;
zend_string **namelist;
#ifdef ZTS
if (!IS_ABSOLUTE_PATH(path, path_len)) {
result = VCWD_GETCWD(cw... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,643 | static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd, zval *rv) /* {{{ */
{
const char *retchar = NULL;
int retint = 0;
int len = 0;
if (obj && obj->za != NULL) {
if (hnd->read_const_char_func) {
retchar = hnd->read_const_char_func(obj->za, &len);
} else {
if (hnd->read_int_func... | DoS Overflow | 0 | static zval *php_zip_property_reader(ze_zip_object *obj, zip_prop_handler *hnd, zval *rv) /* {{{ */
{
const char *retchar = NULL;
int retint = 0;
int len = 0;
if (obj && obj->za != NULL) {
if (hnd->read_const_char_func) {
retchar = hnd->read_const_char_func(obj->za, &len);
} else {
if (hnd->read_int_func... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,644 | static zval *php_zip_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
ze_zip_object *obj;
zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_COPY(&tmp_member, member);
convert... | DoS Overflow | 0 | static zval *php_zip_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
{
ze_zip_object *obj;
zval tmp_member;
zval *retval = NULL;
zip_prop_handler *hnd = NULL;
zend_object_handlers *std_hnd;
if (Z_TYPE_P(member) != IS_STRING) {
ZVAL_COPY(&tmp_member, member);
convert... | @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,645 | static int php_zip_status(struct zip *za) /* {{{ */
{
#if LIBZIP_VERSION_MAJOR < 1
int zep, syp;
zip_error_get(za, &zep, &syp);
#else
int zep;
zip_error_t *err;
err = zip_get_error(za);
zep = zip_error_code_zip(err);
zip_error_fini(err);
#endif
return zep;
}
/* }}} */
| DoS Overflow | 0 | static int php_zip_status(struct zip *za) /* {{{ */
{
#if LIBZIP_VERSION_MAJOR < 1
int zep, syp;
zip_error_get(za, &zep, &syp);
#else
int zep;
zip_error_t *err;
err = zip_get_error(za);
zep = zip_error_code_zip(err);
zip_error_fini(err);
#endif
return zep;
}
/* }}} */
| @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,646 | static char * php_zipobj_get_filename(ze_zip_object *obj) /* {{{ */
{
if (!obj) {
return NULL;
}
if (obj->filename) {
return obj->filename;
}
return NULL;
}
/* }}} */
| DoS Overflow | 0 | static char * php_zipobj_get_filename(ze_zip_object *obj) /* {{{ */
{
if (!obj) {
return NULL;
}
if (obj->filename) {
return obj->filename;
}
return NULL;
}
/* }}} */
| @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,647 | static char * php_zipobj_get_zip_comment(struct zip *za, int *len) /* {{{ */
{
if (za) {
return (char *)zip_get_archive_comment(za, len, 0);
}
return NULL;
}
/* }}} */
| DoS Overflow | 0 | static char * php_zipobj_get_zip_comment(struct zip *za, int *len) /* {{{ */
{
if (za) {
return (char *)zip_get_archive_comment(za, len, 0);
}
return NULL;
}
/* }}} */
| @@ -1281,7 +1281,7 @@ static PHP_NAMED_FUNCTION(zif_zip_entry_read)
}
if (zr_rsrc->zf) {
- buffer = zend_string_alloc(len, 0);
+ buffer = zend_string_safe_alloc(1, len, 0, 0);
n = zip_fread(zr_rsrc->zf, ZSTR_VAL(buffer), ZSTR_LEN(buffer));
if (n > 0) {
ZSTR_VAL(buffer)[n] = '\0';
@@ -2728,7 +2728,7 @@... | CWE-190 | null | null |
43,648 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * inFile)
{
gdIOCtx *in = gdNewFileCtx (inFile);
gdImagePtr im;
if (in == NULL) return NULL;
im = gdImageCreateFromGd2Ctx (in);
in->gd_free (in);
return im;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * inFile)
{
gdIOCtx *in = gdNewFileCtx (inFile);
gdImagePtr im;
if (in == NULL) return NULL;
im = gdImageCreateFromGd2Ctx (in);
in->gd_free (in);
return im;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,649 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
{
int sx, sy;
int i;
int ncx, ncy, nc, cs, cx, cy;
int x, y, ylo, yhi, xlo, xhi;
int vers, fmt;
t_chunk_info *chunkIdx = NULL; /* So we can gdFree it with impunity. */
unsigned char *chunkBuf = NULL; /* So we can gdFree it with impunity. */
int chu... | DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
{
int sx, sy;
int i;
int ncx, ncy, nc, cs, cx, cy;
int x, y, ylo, yhi, xlo, xhi;
int vers, fmt;
t_chunk_info *chunkIdx = NULL; /* So we can gdFree it with impunity. */
unsigned char *chunkBuf = NULL; /* So we can gdFree it with impunity. */
int chu... | @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,650 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h)
{
gdImagePtr im;
gdIOCtx *in = gdNewFileCtx (inFile);
if (in == NULL) return NULL;
im = gdImageCreateFromGd2PartCtx (in, srcx, srcy, w, h);
in->gd_free (in);
return im;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h)
{
gdImagePtr im;
gdIOCtx *in = gdNewFileCtx (inFile);
if (in == NULL) return NULL;
im = gdImageCreateFromGd2PartCtx (in, srcx, srcy, w, h);
in->gd_free (in);
return im;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,651 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w,
int h)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
if(!in)
return 0;
im = gdImageCreateFromGd2PartCtx (in, srcx, srcy, w, h);
in->gd_free (in);
return im;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w,
int h)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
if(!in)
return 0;
im = gdImageCreateFromGd2PartCtx (in, srcx, srcy, w, h);
in->gd_free (in);
return im;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,652 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
{
int scx, scy, ecx, ecy, fsx, fsy;
int nc, ncx, ncy, cs, cx, cy;
int x, y, ylo, yhi, xlo, xhi;
int dstart, dpos;
int i;
/* 2.0.12: unsigned is correct; fixes problems with color munging.
Thanks to Steven Brow... | DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
{
int scx, scy, ecx, ecy, fsx, fsy;
int nc, ncx, ncy, cs, cx, cy;
int x, y, ylo, yhi, xlo, xhi;
int dstart, dpos;
int i;
/* 2.0.12: unsigned is correct; fixes problems with color munging.
Thanks to Steven Brow... | @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,653 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * inFile)
{
_noLibzError();
return NULL;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2 (FILE * inFile)
{
_noLibzError();
return NULL;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,654 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
{
_noLibzError();
return NULL;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ctx (gdIOCtxPtr in)
{
_noLibzError();
return NULL;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,655 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h)
{
_noLibzError();
return NULL;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h)
{
_noLibzError();
return NULL;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,656 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data)
{
_noLibzError();
return NULL;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2Ptr (int size, void *data)
{
_noLibzError();
return NULL;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,657 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
{
_noLibzError();
return NULL;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w, int h)
{
_noLibzError();
return NULL;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,658 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w,
int h)
{
_noLibzError();
return NULL;
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w,
int h)
{
_noLibzError();
return NULL;
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,659 | _gd2CreateFromFile (gdIOCtxPtr in, int *sx, int *sy,
int *cs, int *vers, int *fmt,
int *ncx, int *ncy, t_chunk_info ** cidx)
{
gdImagePtr im;
if (_gd2GetHeader (in, sx, sy, cs, vers, fmt, ncx, ncy, cidx) != 1) {
GD2_DBG (printf ("Bad GD2 header\n"));
goto fail1;
}
if (gd... | DoS Exec Code Overflow | 0 | _gd2CreateFromFile (gdIOCtxPtr in, int *sx, int *sy,
int *cs, int *vers, int *fmt,
int *ncx, int *ncy, t_chunk_info ** cidx)
{
gdImagePtr im;
if (_gd2GetHeader (in, sx, sy, cs, vers, fmt, ncx, ncy, cidx) != 1) {
GD2_DBG (printf ("Bad GD2 header\n"));
goto fail1;
}
if (gd... | @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,660 | _gd2PutHeader (gdImagePtr im, gdIOCtx * out, int cs, int fmt, int cx, int cy)
{
int i;
/* Send the gd2 id, to verify file format. */
for (i = 0; i < 4; i++) {
gdPutC ((unsigned char) (GD2_ID[i]), out);
};
/* */
/* We put the version info first, so future versions can easily change header info. */
/* */
gdPu... | DoS Exec Code Overflow | 0 | _gd2PutHeader (gdImagePtr im, gdIOCtx * out, int cs, int fmt, int cx, int cy)
{
int i;
/* Send the gd2 id, to verify file format. */
for (i = 0; i < 4; i++) {
gdPutC ((unsigned char) (GD2_ID[i]), out);
};
/* */
/* We put the version info first, so future versions can easily change header info. */
/* */
gdPu... | @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,661 | _gd2ReadChunk (int offset, char *compBuf, int compSize, char *chunkBuf,
uLongf * chunkLen, gdIOCtx * in)
{
int zerr;
if (gdTell (in) != offset) {
GD2_DBG (printf ("Positioning in file to %d\n", offset));
gdSeek (in, offset);
} else {
GD2_DBG (printf ("Already Positioned in file to %d\n", offset... | DoS Exec Code Overflow | 0 | _gd2ReadChunk (int offset, char *compBuf, int compSize, char *chunkBuf,
uLongf * chunkLen, gdIOCtx * in)
{
int zerr;
if (gdTell (in) != offset) {
GD2_DBG (printf ("Positioning in file to %d\n", offset));
gdSeek (in, offset);
} else {
GD2_DBG (printf ("Already Positioned in file to %d\n", offset... | @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,662 | _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
{
int ncx, ncy, cx, cy;
int x, y, ylo, yhi, xlo, xhi;
int chunkLen;
int chunkNum = 0;
char *chunkData = NULL; /* So we can gdFree it with impunity. */
char *compData = NULL; /* So we can gdFree it with impunity. */
uLongf compLen;
int idxPos = 0;
int ... | DoS Exec Code Overflow | 0 | _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
{
int ncx, ncy, cx, cy;
int x, y, ylo, yhi, xlo, xhi;
int chunkLen;
int chunkNum = 0;
char *chunkData = NULL; /* So we can gdFree it with impunity. */
char *compData = NULL; /* So we can gdFree it with impunity. */
uLongf compLen;
int idxPos = 0;
int ... | @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,663 | static void _noLibzError (void)
{
gd_error("GD2 support is not available - no libz\n");
}
| DoS Exec Code Overflow | 0 | static void _noLibzError (void)
{
gd_error("GD2 support is not available - no libz\n");
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,664 | BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * outFile, int cs, int fmt)
{
gdIOCtx *out = gdNewFileCtx (outFile);
if (out == NULL) return;
_gdImageGd2 (im, out, cs, fmt);
out->gd_free (out);
}
| DoS Exec Code Overflow | 0 | BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * outFile, int cs, int fmt)
{
gdIOCtx *out = gdNewFileCtx (outFile);
if (out == NULL) return;
_gdImageGd2 (im, out, cs, fmt);
out->gd_free (out);
}
| @@ -165,6 +165,8 @@ _gd2GetHeader (gdIOCtxPtr in, int *sx, int *sy,
if (gdGetInt (&cidx[i].size, in) != 1) {
goto fail2;
};
+ if (cidx[i].offset < 0 || cidx[i].size < 0)
+ goto fail2;
};
*chunkIdx = cidx;
}; | CWE-189 | null | null |
43,665 | SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
const void __user * __user *, pages,
const int __user *, nodes,
int __user *, status, int, flags)
{
const struct cred *cred = current_cred(), *tcred;
struct task_struct *task;
struct mm_struct *mm;
int err;
nodemask_t task_nodes;
/* Check fla... | DoS | 0 | SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
const void __user * __user *, pages,
const int __user *, nodes,
int __user *, status, int, flags)
{
const struct cred *cred = current_cred(), *tcred;
struct task_struct *task;
struct mm_struct *mm;
int err;
nodemask_t task_nodes;
/* Check fla... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,666 | static void __copy_gigantic_page(struct page *dst, struct page *src,
int nr_pages)
{
int i;
struct page *dst_base = dst;
struct page *src_base = src;
for (i = 0; i < nr_pages; ) {
cond_resched();
copy_highpage(dst, src);
i++;
dst = mem_map_next(dst, dst_base, i);
src = mem_map_next(src, src_base, i)... | DoS | 0 | static void __copy_gigantic_page(struct page *dst, struct page *src,
int nr_pages)
{
int i;
struct page *dst_base = dst;
struct page *src_base = src;
for (i = 0; i < nr_pages; ) {
cond_resched();
copy_highpage(dst, src);
i++;
dst = mem_map_next(dst, dst_base, i);
src = mem_map_next(src, src_base, i)... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,667 | void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
spinlock_t *ptl)
{
pte_t pte;
swp_entry_t entry;
struct page *page;
spin_lock(ptl);
pte = *ptep;
if (!is_swap_pte(pte))
goto out;
entry = pte_to_swp_entry(pte);
if (!is_migration_entry(entry))
goto out;
page = migration_entry_to_page(ent... | DoS | 0 | void __migration_entry_wait(struct mm_struct *mm, pte_t *ptep,
spinlock_t *ptl)
{
pte_t pte;
swp_entry_t entry;
struct page *page;
spin_lock(ptl);
pte = *ptep;
if (!is_swap_pte(pte))
goto out;
entry = pte_to_swp_entry(pte);
if (!is_migration_entry(entry))
goto out;
page = migration_entry_to_page(ent... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,668 | static int __unmap_and_move(struct page *page, struct page *newpage,
int force, enum migrate_mode mode)
{
int rc = -EAGAIN;
int page_was_mapped = 0;
struct anon_vma *anon_vma = NULL;
if (!trylock_page(page)) {
if (!force || mode == MIGRATE_ASYNC)
goto out;
/*
* It's not safe for direct compaction to... | DoS | 0 | static int __unmap_and_move(struct page *page, struct page *newpage,
int force, enum migrate_mode mode)
{
int rc = -EAGAIN;
int page_was_mapped = 0;
struct anon_vma *anon_vma = NULL;
if (!trylock_page(page)) {
if (!force || mode == MIGRATE_ASYNC)
goto out;
/*
* It's not safe for direct compaction to... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,669 | static struct page *alloc_misplaced_dst_page(struct page *page,
unsigned long data,
int **result)
{
int nid = (int) data;
struct page *newpage;
newpage = __alloc_pages_node(nid,
(GFP_HIGHUSER_MOVABLE |
__GFP_THISNODE | __GFP_NOMEMALLOC |
__GFP_NORETRY | __GFP_NOWARN) &
~GFP... | DoS | 0 | static struct page *alloc_misplaced_dst_page(struct page *page,
unsigned long data,
int **result)
{
int nid = (int) data;
struct page *newpage;
newpage = __alloc_pages_node(nid,
(GFP_HIGHUSER_MOVABLE |
__GFP_THISNODE | __GFP_NOMEMALLOC |
__GFP_NORETRY | __GFP_NOWARN) &
~GFP... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,670 | static bool buffer_migrate_lock_buffers(struct buffer_head *head,
enum migrate_mode mode)
{
struct buffer_head *bh = head;
/* Simple case, sync compaction */
if (mode != MIGRATE_ASYNC) {
do {
get_bh(bh);
lock_buffer(bh);
bh = bh->b_this_page;
} while (bh != head);
return true;
}
/* async ... | DoS | 0 | static bool buffer_migrate_lock_buffers(struct buffer_head *head,
enum migrate_mode mode)
{
struct buffer_head *bh = head;
/* Simple case, sync compaction */
if (mode != MIGRATE_ASYNC) {
do {
get_bh(bh);
lock_buffer(bh);
bh = bh->b_this_page;
} while (bh != head);
return true;
}
/* async ... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,671 | static inline bool buffer_migrate_lock_buffers(struct buffer_head *head,
enum migrate_mode mode)
{
return true;
}
| DoS | 0 | static inline bool buffer_migrate_lock_buffers(struct buffer_head *head,
enum migrate_mode mode)
{
return true;
}
| @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,672 | int buffer_migrate_page(struct address_space *mapping,
struct page *newpage, struct page *page, enum migrate_mode mode)
{
struct buffer_head *bh, *head;
int rc;
if (!page_has_buffers(page))
return migrate_page(mapping, newpage, page, mode);
head = page_buffers(page);
rc = migrate_page_move_mapping(mapping, ... | DoS | 0 | int buffer_migrate_page(struct address_space *mapping,
struct page *newpage, struct page *page, enum migrate_mode mode)
{
struct buffer_head *bh, *head;
int rc;
if (!page_has_buffers(page))
return migrate_page(mapping, newpage, page, mode);
head = page_buffers(page);
rc = migrate_page_move_mapping(mapping, ... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,673 | static void copy_huge_page(struct page *dst, struct page *src)
{
int i;
int nr_pages;
if (PageHuge(src)) {
/* hugetlbfs page */
struct hstate *h = page_hstate(src);
nr_pages = pages_per_huge_page(h);
if (unlikely(nr_pages > MAX_ORDER_NR_PAGES)) {
__copy_gigantic_page(dst, src, nr_pages);
return;
}
... | DoS | 0 | static void copy_huge_page(struct page *dst, struct page *src)
{
int i;
int nr_pages;
if (PageHuge(src)) {
/* hugetlbfs page */
struct hstate *h = page_hstate(src);
nr_pages = pages_per_huge_page(h);
if (unlikely(nr_pages > MAX_ORDER_NR_PAGES)) {
__copy_gigantic_page(dst, src, nr_pages);
return;
}
... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,674 | static int do_move_page_to_node_array(struct mm_struct *mm,
struct page_to_node *pm,
int migrate_all)
{
int err;
struct page_to_node *pp;
LIST_HEAD(pagelist);
down_read(&mm->mmap_sem);
/*
* Build a list of pages to migrate
*/
for (pp = pm; pp->node != MAX_NUMNODES; pp++) {
struct vm_ar... | DoS | 0 | static int do_move_page_to_node_array(struct mm_struct *mm,
struct page_to_node *pm,
int migrate_all)
{
int err;
struct page_to_node *pp;
LIST_HEAD(pagelist);
down_read(&mm->mmap_sem);
/*
* Build a list of pages to migrate
*/
for (pp = pm; pp->node != MAX_NUMNODES; pp++) {
struct vm_ar... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,675 | static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages,
const void __user * __user *pages,
int __user *status)
{
#define DO_PAGES_STAT_CHUNK_NR 16
const void __user *chunk_pages[DO_PAGES_STAT_CHUNK_NR];
int chunk_status[DO_PAGES_STAT_CHUNK_NR];
while (nr_pages) {
unsigned long chunk_nr;
... | DoS | 0 | static int do_pages_stat(struct mm_struct *mm, unsigned long nr_pages,
const void __user * __user *pages,
int __user *status)
{
#define DO_PAGES_STAT_CHUNK_NR 16
const void __user *chunk_pages[DO_PAGES_STAT_CHUNK_NR];
int chunk_status[DO_PAGES_STAT_CHUNK_NR];
while (nr_pages) {
unsigned long chunk_nr;
... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,676 | static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
const void __user **pages, int *status)
{
unsigned long i;
down_read(&mm->mmap_sem);
for (i = 0; i < nr_pages; i++) {
unsigned long addr = (unsigned long)(*pages);
struct vm_area_struct *vma;
struct page *page;
int err = -EFA... | DoS | 0 | static void do_pages_stat_array(struct mm_struct *mm, unsigned long nr_pages,
const void __user **pages, int *status)
{
unsigned long i;
down_read(&mm->mmap_sem);
for (i = 0; i < nr_pages; i++) {
unsigned long addr = (unsigned long)(*pages);
struct vm_area_struct *vma;
struct page *page;
int err = -EFA... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,677 | static int fallback_migrate_page(struct address_space *mapping,
struct page *newpage, struct page *page, enum migrate_mode mode)
{
if (PageDirty(page)) {
/* Only writeback pages in full synchronous migration */
if (mode != MIGRATE_SYNC)
return -EBUSY;
return writeout(mapping, page);
}
/*
* Buffers may b... | DoS | 0 | static int fallback_migrate_page(struct address_space *mapping,
struct page *newpage, struct page *page, enum migrate_mode mode)
{
if (PageDirty(page)) {
/* Only writeback pages in full synchronous migration */
if (mode != MIGRATE_SYNC)
return -EBUSY;
return writeout(mapping, page);
}
/*
* Buffers may b... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,678 | static bool migrate_balanced_pgdat(struct pglist_data *pgdat,
unsigned long nr_migrate_pages)
{
int z;
for (z = pgdat->nr_zones - 1; z >= 0; z--) {
struct zone *zone = pgdat->node_zones + z;
if (!populated_zone(zone))
continue;
if (!zone_reclaimable(zone))
continue;
/* Avoid waking kswapd by a... | DoS | 0 | static bool migrate_balanced_pgdat(struct pglist_data *pgdat,
unsigned long nr_migrate_pages)
{
int z;
for (z = pgdat->nr_zones - 1; z >= 0; z--) {
struct zone *zone = pgdat->node_zones + z;
if (!populated_zone(zone))
continue;
if (!zone_reclaimable(zone))
continue;
/* Avoid waking kswapd by a... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,679 | int migrate_huge_page_move_mapping(struct address_space *mapping,
struct page *newpage, struct page *page)
{
int expected_count;
void **pslot;
spin_lock_irq(&mapping->tree_lock);
pslot = radix_tree_lookup_slot(&mapping->page_tree,
page_index(page));
expected_count = 2 + page_has_private(page);
if (... | DoS | 0 | int migrate_huge_page_move_mapping(struct address_space *mapping,
struct page *newpage, struct page *page)
{
int expected_count;
void **pslot;
spin_lock_irq(&mapping->tree_lock);
pslot = radix_tree_lookup_slot(&mapping->page_tree,
page_index(page));
expected_count = 2 + page_has_private(page);
if (... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,680 | int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
int node)
{
pg_data_t *pgdat = NODE_DATA(node);
int isolated;
int nr_remaining;
LIST_HEAD(migratepages);
/*
* Don't migrate file pages that are mapped in multiple processes
* with execute permissions as they are probably shared li... | DoS | 0 | int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
int node)
{
pg_data_t *pgdat = NODE_DATA(node);
int isolated;
int nr_remaining;
LIST_HEAD(migratepages);
/*
* Don't migrate file pages that are mapped in multiple processes
* with execute permissions as they are probably shared li... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,681 | int migrate_misplaced_transhuge_page(struct mm_struct *mm,
struct vm_area_struct *vma,
pmd_t *pmd, pmd_t entry,
unsigned long address,
struct page *page, int node)
{
spinlock_t *ptl;
pg_data_t *pgdat = NODE_DATA(node);
int isolated = 0;
struct page *new_page = NULL;
int page_lru = page_is_file_cach... | DoS | 0 | int migrate_misplaced_transhuge_page(struct mm_struct *mm,
struct vm_area_struct *vma,
pmd_t *pmd, pmd_t entry,
unsigned long address,
struct page *page, int node)
{
spinlock_t *ptl;
pg_data_t *pgdat = NODE_DATA(node);
int isolated = 0;
struct page *new_page = NULL;
int page_lru = page_is_file_cach... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,682 | int migrate_page(struct address_space *mapping,
struct page *newpage, struct page *page,
enum migrate_mode mode)
{
int rc;
BUG_ON(PageWriteback(page)); /* Writeback must be complete */
rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
if (rc != MIGRATEPAGE_SUCCESS)
return rc;
migrate... | DoS | 0 | int migrate_page(struct address_space *mapping,
struct page *newpage, struct page *page,
enum migrate_mode mode)
{
int rc;
BUG_ON(PageWriteback(page)); /* Writeback must be complete */
rc = migrate_page_move_mapping(mapping, newpage, page, NULL, mode, 0);
if (rc != MIGRATEPAGE_SUCCESS)
return rc;
migrate... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,683 | int migrate_pages(struct list_head *from, new_page_t get_new_page,
free_page_t put_new_page, unsigned long private,
enum migrate_mode mode, int reason)
{
int retry = 1;
int nr_failed = 0;
int nr_succeeded = 0;
int pass = 0;
struct page *page;
struct page *page2;
int swapwrite = current->flags & PF_SWAPWRITE;... | DoS | 0 | int migrate_pages(struct list_head *from, new_page_t get_new_page,
free_page_t put_new_page, unsigned long private,
enum migrate_mode mode, int reason)
{
int retry = 1;
int nr_failed = 0;
int nr_succeeded = 0;
int pass = 0;
struct page *page;
struct page *page2;
int swapwrite = current->flags & PF_SWAPWRITE;... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,684 | int migrate_prep(void)
{
/*
* Clear the LRU lists so pages can be isolated.
* Note that pages may be moved off the LRU after we have
* drained them. Those pages will fail to migrate like other
* pages that may be busy.
*/
lru_add_drain_all();
return 0;
}
| DoS | 0 | int migrate_prep(void)
{
/*
* Clear the LRU lists so pages can be isolated.
* Note that pages may be moved off the LRU after we have
* drained them. Those pages will fail to migrate like other
* pages that may be busy.
*/
lru_add_drain_all();
return 0;
}
| @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,685 | int migrate_prep_local(void)
{
lru_add_drain();
return 0;
}
| DoS | 0 | int migrate_prep_local(void)
{
lru_add_drain();
return 0;
}
| @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,686 | void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
unsigned long address)
{
spinlock_t *ptl = pte_lockptr(mm, pmd);
pte_t *ptep = pte_offset_map(pmd, address);
__migration_entry_wait(mm, ptep, ptl);
}
| DoS | 0 | void migration_entry_wait(struct mm_struct *mm, pmd_t *pmd,
unsigned long address)
{
spinlock_t *ptl = pte_lockptr(mm, pmd);
pte_t *ptep = pte_offset_map(pmd, address);
__migration_entry_wait(mm, ptep, ptl);
}
| @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,687 | void migration_entry_wait_huge(struct vm_area_struct *vma,
struct mm_struct *mm, pte_t *pte)
{
spinlock_t *ptl = huge_pte_lockptr(hstate_vma(vma), mm, pte);
__migration_entry_wait(mm, pte, ptl);
}
| DoS | 0 | void migration_entry_wait_huge(struct vm_area_struct *vma,
struct mm_struct *mm, pte_t *pte)
{
spinlock_t *ptl = huge_pte_lockptr(hstate_vma(vma), mm, pte);
__migration_entry_wait(mm, pte, ptl);
}
| @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,688 | static int move_to_new_page(struct page *newpage, struct page *page,
enum migrate_mode mode)
{
struct address_space *mapping;
int rc;
VM_BUG_ON_PAGE(!PageLocked(page), page);
VM_BUG_ON_PAGE(!PageLocked(newpage), newpage);
mapping = page_mapping(page);
if (!mapping)
rc = migrate_page(mapping, newpage, page... | DoS | 0 | static int move_to_new_page(struct page *newpage, struct page *page,
enum migrate_mode mode)
{
struct address_space *mapping;
int rc;
VM_BUG_ON_PAGE(!PageLocked(page), page);
VM_BUG_ON_PAGE(!PageLocked(newpage), newpage);
mapping = page_mapping(page);
if (!mapping)
rc = migrate_page(mapping, newpage, page... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,689 | static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
{
int page_lru;
VM_BUG_ON_PAGE(compound_order(page) && !PageTransHuge(page), page);
/* Avoid migrating to a node that is nearly full */
if (!migrate_balanced_pgdat(pgdat, 1UL << compound_order(page)))
return 0;
if (isolate_lru_page(page)... | DoS | 0 | static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page)
{
int page_lru;
VM_BUG_ON_PAGE(compound_order(page) && !PageTransHuge(page), page);
/* Avoid migrating to a node that is nearly full */
if (!migrate_balanced_pgdat(pgdat, 1UL << compound_order(page)))
return 0;
if (isolate_lru_page(page)... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,690 | bool pmd_trans_migrating(pmd_t pmd)
{
struct page *page = pmd_page(pmd);
return PageLocked(page);
}
| DoS | 0 | bool pmd_trans_migrating(pmd_t pmd)
{
struct page *page = pmd_page(pmd);
return PageLocked(page);
}
| @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,691 | static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
unsigned long addr, void *old)
{
struct mm_struct *mm = vma->vm_mm;
swp_entry_t entry;
pmd_t *pmd;
pte_t *ptep, pte;
spinlock_t *ptl;
if (unlikely(PageHuge(new))) {
ptep = huge_pte_offset(mm, addr);
if (!ptep)
goto out;
... | DoS | 0 | static int remove_migration_pte(struct page *new, struct vm_area_struct *vma,
unsigned long addr, void *old)
{
struct mm_struct *mm = vma->vm_mm;
swp_entry_t entry;
pmd_t *pmd;
pte_t *ptep, pte;
spinlock_t *ptl;
if (unlikely(PageHuge(new))) {
ptep = huge_pte_offset(mm, addr);
if (!ptep)
goto out;
... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,692 | static void remove_migration_ptes(struct page *old, struct page *new)
{
struct rmap_walk_control rwc = {
.rmap_one = remove_migration_pte,
.arg = old,
};
rmap_walk(new, &rwc);
}
| DoS | 0 | static void remove_migration_ptes(struct page *old, struct page *new)
{
struct rmap_walk_control rwc = {
.rmap_one = remove_migration_pte,
.arg = old,
};
rmap_walk(new, &rwc);
}
| @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,693 | static ICE_noinline int unmap_and_move(new_page_t get_new_page,
free_page_t put_new_page,
unsigned long private, struct page *page,
int force, enum migrate_mode mode,
enum migrate_reason reason)
{
int rc = MIGRATEPAGE_SUCCESS;
int *result = NULL;
struct page *newpage;
newpage = get_new_... | DoS | 0 | static ICE_noinline int unmap_and_move(new_page_t get_new_page,
free_page_t put_new_page,
unsigned long private, struct page *page,
int force, enum migrate_mode mode,
enum migrate_reason reason)
{
int rc = MIGRATEPAGE_SUCCESS;
int *result = NULL;
struct page *newpage;
newpage = get_new_... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,694 | static int unmap_and_move_huge_page(new_page_t get_new_page,
free_page_t put_new_page, unsigned long private,
struct page *hpage, int force,
enum migrate_mode mode)
{
int rc = -EAGAIN;
int *result = NULL;
int page_was_mapped = 0;
struct page *new_hpage;
struct anon_vma *anon_vma = NULL;
/*
* Movabi... | DoS | 0 | static int unmap_and_move_huge_page(new_page_t get_new_page,
free_page_t put_new_page, unsigned long private,
struct page *hpage, int force,
enum migrate_mode mode)
{
int rc = -EAGAIN;
int *result = NULL;
int page_was_mapped = 0;
struct page *new_hpage;
struct anon_vma *anon_vma = NULL;
/*
* Movabi... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,695 | static int writeout(struct address_space *mapping, struct page *page)
{
struct writeback_control wbc = {
.sync_mode = WB_SYNC_NONE,
.nr_to_write = 1,
.range_start = 0,
.range_end = LLONG_MAX,
.for_reclaim = 1
};
int rc;
if (!mapping->a_ops->writepage)
/* No write method for the address space */
retur... | DoS | 0 | static int writeout(struct address_space *mapping, struct page *page)
{
struct writeback_control wbc = {
.sync_mode = WB_SYNC_NONE,
.nr_to_write = 1,
.range_start = 0,
.range_end = LLONG_MAX,
.for_reclaim = 1
};
int rc;
if (!mapping->a_ops->writepage)
/* No write method for the address space */
retur... | @@ -30,6 +30,7 @@
#include <linux/mempolicy.h>
#include <linux/vmalloc.h>
#include <linux/security.h>
+#include <linux/backing-dev.h>
#include <linux/syscalls.h>
#include <linux/hugetlb.h>
#include <linux/hugetlb_cgroup.h>
@@ -313,6 +314,8 @@ int migrate_page_move_mapping(struct address_space *mapping,
struct ... | CWE-476 | null | null |
43,696 | int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
{
AVStream *st;
MOVStreamContext *sc;
int j, pseudo_stream_id;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
for (pseudo_stream_id=0; pseudo_stream_id<entr... | DoS Exec Code Overflow Mem. Corr. | 0 | int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
{
AVStream *st;
MOVStreamContext *sc;
int j, pseudo_stream_id;
if (c->fc->nb_streams < 1)
return 0;
st = c->fc->streams[c->fc->nb_streams-1];
sc = st->priv_data;
for (pseudo_stream_id=0; pseudo_stream_id<entr... | @@ -401,6 +401,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (entries >= UINT_MAX / sizeof(*sc->drefs))
return AVERROR_INVALIDDATA;
av_free(sc->drefs);
+ sc->drefs_count = 0;
sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
if (!sc->drefs)
r... | CWE-119 | null | null |
43,697 | static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
{
AVIndexEntry *sample = NULL;
int64_t best_dts = INT64_MAX;
int i;
for (i = 0; i < s->nb_streams; i++) {
AVStream *avst = s->streams[i];
MOVStreamContext *msc = avst->priv_data;
if (msc->pb && msc->curr... | DoS Exec Code Overflow Mem. Corr. | 0 | static AVIndexEntry *mov_find_next_sample(AVFormatContext *s, AVStream **st)
{
AVIndexEntry *sample = NULL;
int64_t best_dts = INT64_MAX;
int i;
for (i = 0; i < s->nb_streams; i++) {
AVStream *avst = s->streams[i];
MOVStreamContext *msc = avst->priv_data;
if (msc->pb && msc->curr... | @@ -401,6 +401,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (entries >= UINT_MAX / sizeof(*sc->drefs))
return AVERROR_INVALIDDATA;
av_free(sc->drefs);
+ sc->drefs_count = 0;
sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
if (!sc->drefs)
r... | CWE-119 | null | null |
43,698 | static void mov_metadata_creation_time(AVDictionary **metadata, time_t time)
{
char buffer[32];
if (time) {
struct tm *ptm;
time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
ptm = gmtime(&time);
if (!ptm) return;
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H... | DoS Exec Code Overflow Mem. Corr. | 0 | static void mov_metadata_creation_time(AVDictionary **metadata, time_t time)
{
char buffer[32];
if (time) {
struct tm *ptm;
time -= 2082844800; /* seconds between 1904-01-01 and Epoch */
ptm = gmtime(&time);
if (!ptm) return;
strftime(buffer, sizeof(buffer), "%Y-%m-%d %H... | @@ -401,6 +401,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (entries >= UINT_MAX / sizeof(*sc->drefs))
return AVERROR_INVALIDDATA;
av_free(sc->drefs);
+ sc->drefs_count = 0;
sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
if (!sc->drefs)
r... | CWE-119 | null | null |
43,699 | static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb,
unsigned len, const char *key)
{
char buf[16];
/* bypass padding bytes */
avio_r8(pb);
avio_r8(pb);
avio_r8(pb);
snprintf(buf, sizeof(buf), "%d", avio_r8(pb));
av_dict_se... | DoS Exec Code Overflow Mem. Corr. | 0 | static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb,
unsigned len, const char *key)
{
char buf[16];
/* bypass padding bytes */
avio_r8(pb);
avio_r8(pb);
avio_r8(pb);
snprintf(buf, sizeof(buf), "%d", avio_r8(pb));
av_dict_se... | @@ -401,6 +401,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (entries >= UINT_MAX / sizeof(*sc->drefs))
return AVERROR_INVALIDDATA;
av_free(sc->drefs);
+ sc->drefs_count = 0;
sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
if (!sc->drefs)
r... | CWE-119 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.